H264 stream to MP4 file without the first bytes on the H264 stream

ivan-perez ivan at encore-lab.com
Sun Feb 5 19:45:17 UTC 2017


Tim Müller wrote
> On Fri, 2017-02-03 at 03:14 -0800, ivan-perez wrote:
> 
> Hi,
> 
>> I have a very simple pipeline which converts a H264 stream into a MP4
>> file.
>> It looks like this:
>> 
>>     gst-launch-1.0 -e -v fdsrc
>>       ! video/x-h264,stream-format=avc,alignment=au,...
>>       ! h264parse
>>       ! mp4mux
>>       ! filesink location=test.mp4
> 
> So where does the data come from? What does the H.264 generation? Do
> you have the option of feeding H.264 in byte-stream (annex b) format
> instead?
> 
> The problem here is that you can't really send stream-format=avc over a
> stream such as a pipe or such. You need to maintain the packetisation
> of the avc frames, and streams won't do that (it might look like it
> mostly works, but you can't rely on it unless you force a packet-based
> transport).
> 
> If you can send the data in byte-stream format instead then h264parse
> can sync onto a running stream in the middle. I might be mis-
> understanding the problem though, I'm just guessing here.
> 
> Cheers
>  -Tim
> 
> -- 
> Tim Müller, Centricular Ltd - http://www.centricular.com
> _______________________________________________
> gstreamer-devel mailing list

> gstreamer-devel at .freedesktop

> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

Hi Tim,

I'm going to test if using 'byte-stream' instead of 'avc' could do the
trick.

For clarification, the H264 stream comes from the Raspberry camera, and I
directly pipe it into two GStreamer instances:

* One instance is running all the time, as it takes care of producing a RTP
stream which clients may see at any time.
* Another instance only runs if some conditions are met (for example, after
some detection movement). In that case, I want to save a video of 30 seconds
(in MP4). My idea is to use the stream directly taken from the Raspberry
camera, but at the moment it doesn't work because -I think- in order to work
properly it'd need the first bytes of the stream, which may contain some
headers.

Let me try changing the 'stream-format' parameter and I'll post here if it
works for me or not. Also I'm going to check if there are more options for
'raspivid' (the command I use to generate the H264 stream) to get this work.

Thanks!

Kind regards



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/H264-stream-to-MP4-file-without-the-first-bytes-on-the-H264-stream-tp4681699p4681733.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list