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/AM5728: MP4 file decode

Expert 2990 points
Other Parts Discussed in Thread: AM5728

HI all:

Just now we are using am5728 gstreamer to decode mp4 file.

But it failed.

We use the below command to save mp4 file

gst-launch-1.0 -e v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720, framerate=(fraction)60/1' ! vpe num-input-buffers=8 ! 'video/x-raw,format=(string)NV12, width=(int)1280, height=(int)720, framerate=(fraction)60/1' ! queue ! ducatih264enc bitrate=4000 level=51 profile=100 ! queue ! h264parse ! qtmux ! filesink location=test.mp4

we make sure the test.mp4 is OK, because we can decode it successfully in windows 10 and ubuntu 14.04

When we use the below command to decode the mp4 file, it will reporter error

gst-launch-1.0 -e filesrc location=test.mp4 ! qtdemux ! queue ! h264parse ! ducatih264dec ! queue ! waylandsink

the error is 

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_structure_has_field: assertion 'structure != NULL' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_caps_is_strictly_equal: assertion 'GST_IS_CAPS (caps1)' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_mini_object_unref: assertion '(g_atomic_int_get (&mini_object->lockstate) & LOCK_MASK) < 4' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_structure_has_field: assertion 'structure != NULL' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_caps_is_strictly_equal: assertion 'GST_IS_CAPS (caps1)' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_mini_object_unref: assertion '(g_atomic_int_get (&mini_object->lockstate) & LOCK_MASK) < 4' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_structure_has_field: assertion 'structure != NULL' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_caps_is_strictly_equal: assertion 'GST_IS_CAPS (caps1)' failed

(gst-launch-1.0:1428): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed
Caught SIGSEGV
#0 0xb6b45e50 in poll () at ../sysdeps/unix/syscall-template.S:81
#1 0xb6c789f8 in ?? () from /usr/lib/libglib-2.0.so.0
Spinning. Please run 'gdb gst-launch-1.0 1428' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.

My processor sdk is processor sdk rt_linux 3.3

The board is an custom am5728 board.

So, any other encountered this issue?

Thanks

Regards

  • Please enter your part number and software when starting a new thread. These are required fields.
  • Hi Biser Gatchev-XID

    I'm sorry We don't have the part number

    How can I get the part number

  • You are asking about AM5728. This is the part number:

  • Hello,

    The decoding pipeline seems wrong. Please try this:
    gst-launch-1.0 playbin uri=file:///home/root/x1.mp4 video-sink=waylandsink
    Please change only the path to the file and file name.
    Let me know the result.

    BR
    Margarita

  • HI Margarita:

    The below command can work.

    The gst-launch-1.0 playbin uri=file:///home/root/x1.mp4 video-sink=waylandsink

    So How can we change the playbin to the real pipeline like this:

    gst-launch-1.0 -e filesrc location=test.mp4 ! qtdemux ! queue ! h264parse ! ducatih264dec ! queue ! waylandsink

    Thanks

    Regards

  • Hello,

    You could try:
    gst-launch-1.0 filesrc location=test.mp4 ! qtdemux ! h264parse ! ducatih264decvpe ! 'video/x-raw, format=(string)NV12, width=(int)800, height=(int)600' ! waylandsink
    Please change the caps filter depending of your resolution.

    You could try also this one:
    gst-launch-1.0 filesrc location=test.mp4 ! qtdemux ! h264parse ! ducatih264decvpe ! waylandsink




    BR
    Margarita
  • HI Margarita:

    Thanks for you reply

    1 We have test the command

    gst-launch-1.0 filesrc location=test.mp4 ! qtdemux ! h264parse ! ducatih264decvpe ! 'video/x-raw, format=(string)NV12, width=(int)800, height=(int)600' ! waylandsink

    But it can only play a few frames and then crashed.

    The below is the error:

    Setting pipeline to PAUSED ...
    [ 45.682893] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    Pipeline is PREROLLING ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_structure_has_field: assertion 'structure != NULL' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_caps_is_strictly_equal: assertion 'GST_IS_CAPS (caps1)' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_mini_object_unref: assertion '(g_atomic_int_get (&mini_object->lockstate) & LOCK_MASK) < 4' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_structure_has_field: assertion 'structure != NULL' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_caps_is_strictly_equal: assertion 'GST_IS_CAPS (caps1)' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_structure_has_field: assertion 'structure != NULL' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_caps_is_strictly_equal: assertion 'GST_IS_CAPS (caps1)' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_mini_object_unref: assertion '(g_atomic_int_get (&mini_object->lockstate) & LOCK_MASK) < 4' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed[ 47.068961] ------------[ cut here ]------------


    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_structure_has_field: assertion 'structure != NULL' failed

    (gst-launch-1.0:1330): GStreamer-CRITICAL **: gst_caps_is_strictly_equal: assertion 'GST_IS_CAPS (caps1)' failed
    *** Error in `gst-launch-1.0': free(): invalid pointer: 0xb5392e78 ***
    47.077025] WARNING: CPU: 1 PID: 1334 at /home/gtbldadm/processor-sdk-linux-rt-krogoth-build/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work-shared/am57xx-evm/kernel-source/drivers/media/platform/ti-vpe/v)
    [ 47.126857] Modules linked in: sii9293(O) adv7842(O) bc_example(O) cbc drbg xhci_plat_hcd xhci_hcd usbcore xfrm_user xfrm4_tunnel rpmsg_pru ipcomp xfrm_ipcomp rpmsg_proto esp4 rpmsg_rpc ah4 af_key xfrm_algo dwc3)
    [ 47.197275] CPU: 1 PID: 1334 Comm: qtdemux0:sink Tainted: G O 4.4.41-rt50-g968d071ce9 #1
    [ 47.197278] Hardware name: Generic DRA74X (Flattened Device Tree)
    [ 47.197282] Backtrace:
    [ 47.197299] [<c00130f4>] (dump_backtrace) from [<c00132f0>] (show_stack+0x18/0x1c)
    [ 47.197308] r7:bf0cd704 r6:600e0013 r5:00000000 r4:c0944374
    [ 47.197318] [<c00132d8>] (show_stack) from [<c02bb7c4>] (dump_stack+0x8c/0xa0)
    [ 47.197328] [<c02bb738>] (dump_stack) from [<c00346e4>] (warn_slowpath_common+0x88/0xb8)
    [ 47.197336] r7:bf0cd704 r6:00000179 r5:00000009 r4:00000000
    [ 47.197345] [<c003465c>] (warn_slowpath_common) from [<c00347b8>] (warn_slowpath_null+0x24/0x2c)
    [ 47.197353] r8:ed1ba5a0 r7:ee4f7a10 r6:ed74f73c r5:ed74f410 r4:ec515d6c
    [ 47.197370] [<c0034794>] (warn_slowpath_null) from [<bf0cd704>] (vpdma_free_desc_buf+0x44/0x48 [ti_vpdma])
    [ 47.197391] [<bf0cd6c0>] (vpdma_free_desc_buf [ti_vpdma]) from [<bf0cd71c>] (vpdma_free_desc_list+0x14/0x20 [ti_vpdma])
    [ 47.197395] r5:ed74f410 r4:ec515d6c
    [ 47.197417] [<bf0cd708>] (vpdma_free_desc_list [ti_vpdma]) from [<bf10e6e4>] (vpe_release+0x3c/0xb0 [ti_vpe])
    [ 47.197421] r5:ed74f410 r4:ec515c00
    [ 47.197438] [<bf10e6a8>] (vpe_release [ti_vpe]) from [<c0493070>] (v4l2_release+0x40/0x7c)
    [ 47.197444] r7:ee4f7a10 r6:00000000 r5:ed74f480 r4:ecb8b500
    [ 47.197455] [<c0493030>] (v4l2_release) from [<c0127320>] (__fput+0x88/0x1d0)
    [ 47.197459] r5:ec8d1e50 r4:ecb8b500
    [ 47.197467] [<c0127298>] (__fput) from [<c01274c8>] (____fput+0x10/0x14)
    [ 47.197476] r10:ed6b3ec4 r9:dfe77180 r8:ec95b250 r7:ec450740 r6:dfe7c600 r5:c0974874
    [ 47.197479] r4:ec450c40
    [ 47.197489] [<c01274b8>] (____fput) from [<c004e9b8>] (task_work_run+0x98/0xcc)
    [ 47.197497] [<c004e920>] (task_work_run) from [<c00374d0>] (do_exit+0x300/0x9c0)
    [ 47.197503] r7:d2895e40 r6:00000001 r5:ec450c58 r4:ec450740
    [ 47.197508] [<c00371d0>] (do_exit) from [<c0037c14>] (do_group_exit+0x48/0xc4)
    [ 47.197511] r7:d2895edc
    [ 47.197520] [<c0037bcc>] (do_group_exit) from [<c0041f88>] (get_signal+0x22c/0x5c0)
    [ 47.197526] r7:d2895edc r6:020c0027 r5:d2894000 r4:08430000
    [ 47.197535] [<c0041d5c>] (get_signal) from [<c0012848>] (do_signal+0xd0/0x3b4)
    [ 47.197544] r10:00000000 r9:d2894000 r8:00000000 r7:b6af1996 r6:d2895ec8 r5:b6af1994
    [ 47.197546] r4:d2895fb0
    [ 47.197554] [<c0012778>] (do_signal) from [<c0012cf4>] (do_work_pending+0xa8/0xc0)
    [ 47.197563] r10:00000000 r9:d2894000 r8:c000fbc4 r7:0000010c r6:d2895fb0 r5:c000fbc4
    [ 47.197565] r4:d2894000
    [ 47.197573] [<c0012c4c>] (do_work_pending) from [<c000fa74>] (slow_work_pending+0xc/0x20)
    [ 47.197580] r7:0000010c r6:b6bc5088 r5:b51ff470 r4:b51ff930
    [ 47.197582] ---[ end trace 0000000000000002 ]---

    2 When we used the below comand to test.

    gst-launch-1.0 filesrc location=test.mp4 ! qtdemux ! h264parse ! ducatih264decvpe ! waylandsink

    It also can play a few frames and then crashed.

    The below is the error:

    root@am57xx-evm:~# gst-launch-1.0 filesrc location=test.mp4 ! qtdemux ! h264parse ! ducatih264decvpe ! waylandsink
    Setting pipeline to PAUSED ...
    [ 211.081241] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    Pipeline is PREROLLING ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock

    (gst-launch-1.0:1348): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

    (gst-launch-1.0:1348): GStreamer-CRITICAL **: gst_structure_has_field: assertion 'structure != NULL' failed

    (gst-launch-1.0:1348): GStreamer-CRITICAL **: gst_caps_is_strictly_equal: assertion 'GST_IS_CAPS (caps1)' failed

    (gst-launch-1.0:1348): GStreamer-CRITICAL **: gst_mini_object_unref: assertion '(g_atomic_int_get (&mini_object->lockstate) & LOCK_MASK) < 4' failed

    (gst-launch-1.0:1348): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed

    (gst-launch-1.0:1348): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

    (gst-launch-1.0:1348): GStreamer-CRITICAL **: gst_structure_has_field: assertion 'structure != NULL' failed

    (gst-launch-1.0:1348): GStreamer-CRITICAL **: gst_caps_is_strictly_equal: assertion 'GST_IS_CAPS (caps1)' failed
    *** Error in `gst-launch-1.0': double free or corruption (out): 0xb530afc0 ***

  • Hello,

    I tested this pipeline on my side:
    root@am57xx-evm:~# gst-launch-1.0 filesrc location=test.mp4 ! qtdemux ! h264parse ! ducatih264decvpe ! 'video/x-raw, format=(string)NV12, width=(int)800, height=(int)480' ! waylandsink
    Setting pipeline to PAUSED ...
    [ 189.786042] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    Pipeline is PREROLLING ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    Got EOS from element "pipeline0".
    Execution ended after 0:00:19.933032570
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...

    As you could see it is working.

    I tested this one also:
    root@am57xx-evm:~# gst-launch-1.0 filesrc location=test.mp4 ! qtdemux ! h264parse ! ducatih264decvpe ! waylandsink
    Setting pipeline to PAUSED ...
    [ 267.791520] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    Pipeline is PREROLLING ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    Got EOS from element "pipeline0".
    Execution ended after 0:00:19.949526320
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...

    It is working also.

    Since the video file could be played with playbin I would recommend you to add -v and check which elements are connected in the pipeline so you could recover the pipeline. Playbin element is element that have, automatic file type recognition and based on that automatic selection and usage of the right demuxers/decoders etc. Playbin automatically add and link the elements based on the input file.


    BR
    Margarita
  • Dear Margarita

    We have play the mp4 file successfully using the below command
    gst-launch-1.0 -e -v filesrc location=test.mp4 ! qtdemux ! queue ! h264parse ! 'video/x-h264' ! ducatih264decvpe ! queue ! waylandsink

    Now we have anther question,
    in the am5728 platform, there are two mp4 element, which is qtmux and mp4mux.
    we can use the two to produce the mp4 file.
    gst-launch-1.0 -e v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720, framerate=(fraction)60/1' ! vpe num-input-buffers=8 ! 'video/x-raw,format=(string)NV12, width=(int)1280, height=(int)720, framerate=(fraction)60/1' ! queue ! ducatih264enc bitrate=4000 level=51 profile=100 ! queue ! h264parse ! mp4mux ! filesink location=test.mp4

    gst-launch-1.0 -e v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720, framerate=(fraction)60/1' ! vpe num-input-buffers=8 ! 'video/x-raw,format=(string)NV12, width=(int)1280, height=(int)720, framerate=(fraction)60/1' ! queue ! ducatih264enc bitrate=4000 level=51 profile=100 ! queue ! h264parse ! qtmux ! filesink location=test.mp4

    So what is the difference between qtmux and mp4mux?



    Regards
    xixi

  • Hello,

    The quicktime format can have some extensions that the mp4 does not and vis versa.

    Qtmux element merges streams (audio and video) into QuickTime(.mov) files.

    Mp4mux element merges streams (audio and video) into ISO MPEG-4 (.mp4) files.

    You could check these links for more information:

    https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-qtmux.html

    https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-mp4mux.html

    https://en.wikipedia.org/wiki/QuickTime_File_Format

    Please, if this answer your question could you close this thread.

    BR
    Margarita

  • Thanks
    Regards