This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM4378: H.264 file decoding

Part Number: AM4378


Tool/software: Linux

Dear Experts,

I have 4 questions listed below I'm hoping somebody can help me with.

I'm using an AM437x GP EVM running ti-processor-sdk-linux-am437x-evm-03.02.00.05 pre-built image booting from SD card. I have an mp4 (h.264) file that I want to decode and measure the performance in terms of framerate and CPU loading. The file I'm decoding has the following specs as reported by vnc.

Codec: H264 - MPEG-4 AVC (part 10)(avc1)
Resolution: 768x322
Frame rate: 24

I'm new to gstreamer but I've managed to get something working. With weston running, but matrix killed, I can use

root@am437x-evm:~# gst-play-1.0 /tmp/MyFile.mp4

I put the file into the tmp filesystem which I believe is RAM based as opposed to reading from SD card. It didn't really make a performance difference though. It decodes properly and I can see it in a weston window. The problem I have is, it's only getting about what looks like about 5fps. I would have expected more I guess. top reports roughly 75% CPU load for gstreamer and another 11% for weston.

I tried other gstreamer methods like the following,

gst-launch-1.0 -v playbin uri=file:/tmp/MyFile.mp4

Pretty much get the same results. So my first question is:

Q1) Is there a better pipeline I should use to get better performance?

Next, I started examining the h/264 decode example in the Matrix GUI under Multimedia. I found on a TI wiki page, and this matches what shows on the matrix screen, the gstreamer pipeline used.

gst-launch-0.10 filesrc location=$filename ! h264parse ! ffdec_h264 ! ffmpegcolorspace ! fbdevsink device=/dev/fb0

However, when I try that, I get

root@am437x-evm:~# gst-launch-1.0 filesrc location=/tmp/MyFile.mp4 ! h264parse ! ffdec_h264 ! ffmpegcolorpsace ! fbdevsink device=/dev/fb0
WARNING: erroneous pipeline: no element "ffdec_h264"

So I have a couple questions related to this

Q2) Is this not the gstreamer command used for the Matrix GUI H.264 decode example?

Q3) What resolution and framerate is the matrix H.264 decode demo?

This is a more generic question

Q4) Does anybody know how to measure framerate while using gstreamer? I googled it for a while but nothing seems to be working for me.

Thanks,

  • Hello,

    AM4738 does not have IVA subsystem so the codes which are running on the board are software codecs.

    Brad Caldwell said:
    root@am437x-evm:~# gst-launch-1.0 filesrc location=/tmp/MyFile.mp4 ! h264parse ! ffdec_h264 ! ffmpegcolorpsace ! fbdevsink device=/dev/fb0
    WARNING: erroneous pipeline: no element "ffdec_h264"

    Gstreamer version 1.0 does not has ffdec_h264 element, there is no ffmpegcolorspace also. These elements are used in gstreamer version 0.10. That is why you are seeing this error.

    Gstreamer version 1.0 has avdec_h264 element but I would recommend you to check with:

    gst-inspect-1.0 | grep "h264" what codecs you have.

    I do not have am4738 board on my side so I would not be able to try.

    For the decoding I would recommend you to use playbin element for gstreamer version 1.0.

     gst-launch-1.0 playbin uri=file:///<path_to_file> 


    Here is examples for gstreamer version 0.10:
    http://processors.wiki.ti.com/index.php/ARM_Multimedia_Users_Guide

    Brad Caldwell said:
    Q4) Does anybody know how to measure framerate while using gstreamer?

    You could try :
    gst-inspect-1.0 "fpsdisplaysink"
    and use this element instead of video sink element. fpsdisplaysink element is for gst version 1.0 not for 0.10.
    In this case the pipeline should be:
    gst-launch-1.0 -v playbin uri=file:/tmp/MyFile.mp4 video-sink=fpsdisplaysink

    Hope this helps.

    BR
    Margarita

  • Thanks Margarita,
    I was able to successfully use avdec_h264 and fpsdisplaysink and get framerate measurements, here' my pipeline

    gst-launch-1.0 -v filesrc location="/tmp/MyFile.h264" ! queue ! h264parse ! "avdec_h264" ! videoconvert ! queue ! fpsdisplaysink video-sink=fbdevsink

    I realize the AM437x is not intended for real-time video decode but I still needed to do some benchmarks, I have that data now.

    I still have questions Q2 and Q3 open, could you or anybody else answer those. I did some digging in the matrix code and I still can't find the actual command line and/or app used when the h.264 decode demo is run.
  • Hello,

    Regarding question 2:
    The application demos which could be run by selecting the "Multimedia" icon at the top-level matrix are shell scripts( *.sh), they are running gstreamer pipelines.
    For example for am57x they are allocated in /usr/bin.

    BR
    Margarita
  • I found the scripts in /usr/bin. That was helpful. Thanks