qtmux/qtdemux : Not able to stitch back the fragmented input MP4 file using splitmuxsrc
Hi ,
When we use "splitmuxsink" with "qtmux" to split input files into fragments and try to stitch them back to original MP4 file, "qtmux" is giving "Buffer has no PTS." error.
Command 1:
gst-launch-1.0 filesrc location=bbb_sunflower_1080p_60fps_normal.mp4 ! qtdemux ! splitmuxsink muxer=qtmux max-size-time=80000000000 location=tmpfile%02d.mp4
Command 2:
gst-launch-1.0 splitmuxsrc location=tmpfile0* ! h264parse ! qtmux ! filesink location=output.mp4
Command 2, using "splitmuxsrc" is giving "Buffer has no PTS." error.
On doing some basic analysis, I figured out that "h264parse" before "qtmux" is receiving duplicate PTS. Hence "h264parse" producing a buffer with PTS as "none". This is causing "qtmux" to give "Buffer has no PTS." error.
Analysis:
gst-launch-1.0 splitmuxsrc location=tmpfile0* ! identity silent=false ! h264parse ! qtmux ! filesink location=del.mp4 -v
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1919 bytes, dts: 0:01:19.783333333, pts: 0:01:19.800000000, duration: 0:00:00.016666667, offset: -1, offset_end: -1, flags: 00002000 delta-unit , meta: none) 0x7f5cfc02e000 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (8674 bytes, dts: 0:01:19.800000000, pts: 0:01:19.883333333, duration: 0:00:00.016666667, offset: -1, offset_end: -1, flags: 00002000 delta-unit , meta: none) 0x7f5cfc02c360 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1935 bytes, dts: 0:01:19.816666667, pts: 0:01:19.850000000, duration: 0:00:00.016666666, offset: -1, offset_end: -1, flags: 00002000 delta-unit , meta: none) 0x7f5cfc02e5a0 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1717 bytes, dts: 0:01:19.833333333, pts: 0:01:19.833333333, duration: 0:00:00.016666667, offset: -1, offset_end: -1, flags: 00002000 delta-unit , meta: none) 0x7f5cfc02c000 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1492 bytes, dts: 0:01:19.850000000, pts: 0:01:19.866666667bbb_sunflower_1080p_60fps_normal, duration: 0:00:00.016666667, offset: -1, offset_end: -1, flags: 00002000 delta-unit , meta: none) 0x7f5cfc0297e0 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = event ******* (identity0:sink) E (type: tag (20510), GstTagList-stream, taglist=(taglist)"taglist,\ video-codec=(string)"H.264\\ /\\ AVC",\ maximum-bitrate=(uint)19727256,\ bitrate=(uint)4001448;";) 0x7f5cec002b20 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (289041 bytes, dts: 0:01:19.833333334, pts: 0:01:19.866666667, duration: 0:00:00.016666666, offset: -1, offset_end: -1, flags: 00000000 , meta: none) 0x7f5cf0006c60 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (5777 bytes, dts: 0:01:19.850000000, pts: 0:01:19.933333334, duration: 0:00:00.016666667, offset: -1, offset_end: -1, flags: 00002000 delta-unit , meta: none) 0x7f5cf00067e0 ERROR: from element /GstPipeline:pipeline0/GstQTMux:qtmux0: Could not multiplex stream. Additional debug info: gstqtmux.c(4832): gst_qt_mux_add_buffer (): /GstPipeline:pipeline0/GstQTMux:qtmux0: Buffer has no PTS. Execution ended after 0:00:00.240679964
If I use "matroskamux" in place of "qtmux" in "Command 1", then everything works fine.