Re: Tee causing invalid h264 file
Tim-Philipp Müller via gstreamer-devel <[email protected]> Tue, 02 Jan 2024 15:01:16 +0000
| Newsgroups | gmane.comp.video.gstreamer.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Peter, > When I run with this pipeline: > gst-launch-1.0 -ve sunxisrc keyint=12 bitrate=5000 ! video/x- > h264,width=1280,height=720,framerate=60/1 ! h264parse ! tee name=t \ > t. ! queue ! filesink location=TeeTestNoOtherTee.h264 > I get a valid file. > > When I run with > gst-launch-1.0 -ve sunxisrc keyint=12 bitrate=5000 ! video/x- > h264,width=1280,height=720,framerate=60/1 ! h264parse ! tee name=t \ > t. ! queue ! filesink location=TeeTestWithOtherTee.h264 \ > t. ! queue ! rtph264pay mtu=1024 ! rtph264depay ! h264parse > config-interval=1 ! fakesink > > I get an h264 file that fails to play with ffplay: (snip details) > Any thoughts about what is going on? H.264 can be packetised in different stream formats. In one case you end up writing video/x-h264,stream-format=byte-stream into the file (aka "Annex B" format), in the other case video/x-h264,stream- format=avc3. Annex B is self-synchronising and can be detected and read from a file, whereas AVC/AVC3 format isn't really meant for writing into a stream or file without external packetisation and should go into a container such as Matroska or mp4. (In general, it's best to always use a container in any case) You can force the output format by putting a capsfilter with filtercaps behind h264parse, e.g. h264parse ! video/x-h264,stream-format=byte-stream ! .... Automatic negotiation with a tee and multiple tee branches in the mix is a bit tricky, and doesn't always work right unfortunately. (It may or may not be fixed in newer versions of GStreamer, I haven't checked. 1.18 is quite old now.) Cheers Tim