Split MPEG-TS into MP4 files with gstreamer 1.12.2

后端 未结 1 1571
自闭症患者
自闭症患者 2021-01-07 07:31

I have a MPEG-TS file which contains two video/audio stream-pairs:

$ gst-discoverer-1.0 Recorder_Aug01_12-30-39.ts
Analyzing Recorder_Aug01_12-30-39.ts
Done          


        
1条回答
  •  星月不相逢
    2021-01-07 07:54

    GStreamer Buffer has no PTS Failure Mode

    This may not completely solve the problem using GStreamer, but this is a workaround that I'm now using. It involves isolating out the failing component which is the 'mp4mux' element in the gstreamer pipeline.

    I'm finding that even a sample video encoding in Gstreamer is currently failing e.g. with the Buffer has no PTS failure mode:

    gst-launch-1.0 videotestsrc num_buffers=300 ! videoconvert ! videoscale ! omxh264enc ! h264parse ! mp4mux ! filesink location=test.mp4
    

    Using Gstreamer for h264 Encoding only.

    Removing the mp4mux element allows us to successfully create .h264 files. Particularly handy if you're using a Raspberry Pi omxh264 encoder element.

    gst-launch-1.0 videotestsrc num_buffers=300 ! videoconvert ! videoscale ! omxh264enc ! filesink location=test.h264
    

    Solving the problem of Mixing Audio and Video

    Now to convert that into an MP4 (the initial goal) we can use the nice lightweight Gpac MP4box.

    sudo apt-get install gpac
    
    MP4Box -isma -inter 250 -fps 30.0 -mpeg4 -hint -noprog -add test.h264 test.mp4
    

    Then you can add in your audio

    MP4Box -add audio.mp3 test.mp4
    

    Summary

    1. GStreamer appears currently broken with the No PTS failure mode when using Mp4Mux element.
    2. GStreamer general h264 encoding and piplines are awesome, and working.
    3. Using GPac to combine audio into Mp4 files is a viable alternative.

    0 讨论(0)
提交回复
热议问题