Hi, I need to join some .mp4 clips (video only, all created with the same parameters) and create a single playable .mp4 file using gstreamer. Testing this on gstreamer 1.6.3 (the target version) and 1.16. The results have been the same on either of those versions. We found slomo's blog post and the first file related example basically just does a cat of two files so it doesn't of course play properly, it just plays the first clip in the output file and ends. The second example gst-launch-1.0 concat name=c ! queue ! avdec_h264 ! queue ! videoconvert ! videoscale ! autovideosink filesrc location=1.mp4 ! qtdemux ! h264parse ! c. filesrc location=2.mp4 ! qtdemux ! h264parse ! c. Streams fine to the display but if I replace autovideosink with filesink location=foodoo.mp4 I get a very large .mp4 file (larger than the combined input files e.g. 64 Mbytes vs 398 Mbytes from this pipeline. While the video "plays" it is blank. I asked on the IRC channel and received this pipeline: gst-launch-1.0 concat name=c ! queue ! qtmux ! filesink location=output.mp4 filesrc location=1.mp4 ! qtdemux ! h264parse ! c. filesrc location=2.mp4 ! qtdemux ! h264parse ! c. But that fails with "WARNING: erroneous pipeline: could not link h264parse0 to c" So can anyone point me to a working example of how to use concat to accomplish the task, or a working alternative method. We need to use gstreamer or we could leverage cvlc to do this (that works, but is not an option). Thanks, Burt _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Sun, 2020-04-05 at 08:50 -0700, [hidden email] wrote:
> > We found slomo's blog post and the first file related example > basically just does a cat of two files so it doesn't of course play > properly, it just plays the first clip in the output file and ends. That depends on the file format, but for MP4 that's certainly true. > The second example > gst-launch-1.0 concat name=c ! queue ! avdec_h264 ! queue ! > videoconvert ! videoscale ! autovideosink filesrc location=1.mp4 ! > qtdemux ! h264parse ! c. filesrc location=2.mp4 ! qtdemux ! > h264parse ! c. > > Streams fine to the display but if I replace autovideosink with > filesink location=foodoo.mp4 I get a very large .mp4 file (larger > than the combined input files e.g. 64 Mbytes vs 398 Mbytes from this > pipeline. While the video "plays" it is blank. into a file. That's not going to work like this. The concat element is not doing any magic, it's only concatenating two or more streams into a continuous timeline. > I asked on the IRC channel and received this pipeline: > gst-launch-1.0 concat name=c ! queue ! qtmux ! filesink > location=output.mp4 filesrc location=1.mp4 ! qtdemux ! h264parse ! > c. filesrc location=2.mp4 ! qtdemux ! h264parse ! c. > > But that fails with "WARNING: erroneous pipeline: could not link > h264parse0 to c" Check the debug logs for the reason why it is failing to link. Due to how the pipeline string parser works, this is connecting concat with the audio sink pad of qtmux, and that of course doesn't work for video. That's why I usually recommend to write proper code for such pipelines, it also makes everything more maintainable and debuggable. The following pipeline works here for me: gst-launch-1.0 concat name=c ! queue ! m.video_0 qtmux name=m ! filesink location=test.mp4 filesrc location=in.mp4 ! qtdemux ! h264parse ! c. filesrc location=in.mp4 ! qtdemux ! h264parse ! c. If you use different input files then you need to make sure that the h264 streams of both are completely compatible as MP4 does not allow stream format changes mid-stream. Specifically for H264 that means that the SPS and PPS need to be the same. -- Sebastian Dröge, Centricular Ltd · https://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (981 bytes) Download Attachment |
In reply to this post by burt
Thanks Sebastian... Initially this pipeline choked with the two different test clips, so just used the same clip for 1 and 2. And that works. As far as I know both clips were created with the same parameters, but I may have missed something so I'll have some digging to do but this is closer to what we need. Thanks again for your assistance. Burt
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
How about splitmuxsrc and splitmuxsink?
----- GStreamer is a convenient multimedia platform, I like it. Develop the NVR system on ARM/x86(c/python) Use python to generate NVR is crazy, of course works fine. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |