How to make/fix mp4 file can be play on vlc?

Psychesnet Hsieh psychesnet at gmail.com
Tue Jul 28 07:15:49 UTC 2020


Hi gotsring,

I figure out the problem.
Pipeline need h264parse to convert byte-stream to avc and mp4mux can mix
H264 frames as mp4 file.
Thanks a lot.

Psychesnet Hsieh <psychesnet at gmail.com> 於 2020年7月28日 週二 上午9:31寫道:

> Hi gotsring,
>
> Thanks for the reply.
>
> Our platform did not support MKV mux module on gstreamer component. So, I
> still need to work on mp4mux.
>
> I double check the option of '-e' from tools/gst-launch.c and I add
> following code to my testing tool.
> 1. The duration of mp4 file is over 10 sec, we will send EOS event.
> *if (((hdr->fpts.tv_sec - app->first_pts.tv_sec >= 10) &&
> (hdr->fpts.tv_usec >= app->first_pts.tv_usec)) ||*
>
>
> *            hdr->fpts.tv_sec - app->first_pts.tv_sec > 10)) {
>   ok = FALSE;}*
> *.....*
> *if (ok == FALSE) {*
>
>
> *         GST_INFO("send EOS event\n");
> gst_element_send_event(app->pipeline, gst_event_new_eos());}*
> 2. At message part, when we recv EOS, we will do stop loop.
>
>
>
> *        case GST_MESSAGE_EOS: {
>  g_printerr("recv EOS msg\n");
>  g_main_loop_quit (app->loop);                                 break;*
> *                              }*
> 3. Double check the log from testing tool, testing tool did send EOS to
> pipeline.
>
>
>
>
>
>
>
>
> *0:00:09.650924349  1255      0x3611e00 INFO         appsrc-pipeline
> ringbuf_appsrc.cpp:77:read_data: send EOS event0:00:09.653614066  1255
>  0x36b10a0 INFO                    task
> gsttask.c:312:gst_task_func:<ringbuf:src> Task going to
> paused0:00:09.653862576  1255      0x36b10a0 INFO                    task
> gsttask.c:314:gst_task_func:<ringbuf:src> Task resume from
> paused0:00:09.654003645  1255      0x36b10a0 INFO                 basesrc
> gstbasesrc.c:2854:gst_base_src_loop:<ringbuf> pausing after
> gst_base_src_get_range() = eos0:00:09.654223941  1255      0x36b10a0 INFO
>                  task gsttask.c:312:gst_task_func:<ringbuf:src> Task going
> to paused0:00:09.654832350  1255      0x3611e00 INFO
> appsrc-pipeline ringbuf_appsrc.cpp:108:bus_message: got message eosrecv EOS
> msg0:00:10.655268590  1255      0x3611e00 INFO         appsrc-pipeline
> ringbuf_appsrc.cpp:215:main: stopping*
>
> Add above code, mp4 file still not working on VLC player.
> Please provide advise to fix it. Thanks.
>
>
> gotsring <gotsring at live.com> 於 2020年7月28日 週二 上午3:07寫道:
>
>> Are you finalizing the MP4 file? This is done by sending an EOS signal
>> through the pipeline. For the gst-launch command-line tool, just add -e in
>> the options, like
>> gst-launch-1.0 -e appsrc name=ringbuf ! mp4mux ! filesink
>> location=/tmp/opt/h264.mp4
>>
>> On a side note, I prefer MKV containers instead of MP4 because they tend
>> to
>> be more resistant to errors. If you don't finalize an MKV file, you can
>> still play the video, scrubbing or other metadata isn't available. If you
>> don't finalize the MP4 file, the file is unplayable. MKV files can still
>> play in VLC, so you'd be good there.
>>
>> Example:
>> gst-launch-1.0 -e appsrc name=ringbuf ! matroskamux ! filesink
>> location=/tmp/opt/h264.mkv
>>
>> You might need a parser right before the matroskamux, like h264parse.
>>
>>
>>
>> --
>> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200728/711ba5db/attachment.htm>


More information about the gstreamer-devel mailing list