[FFmpeg-devel] H264: mp4toannexb BSF and streaming

Alexandre Ferrieux alexandre.ferrieux
Wed Aug 18 17:35:22 CEST 2010

On 18/08/2010 17:18, Luca Abeni wrote:
> On 18/08/10 16:33, Alexandre Ferrieux wrote:
>> On 18/08/2010 16:18, Tomas H?rdin wrote:
>>> On Wed, 2010-08-18 at 16:06 +0200, Alexandre Ferrieux wrote:
>>>> On 18/08/2010 15:33, Alexandre Ferrieux wrote:
>>>>> What I'm trying to do is understand where these "important" extradata
>>>>> are in the 3GP chunk hierarchy:
>>>>> - either they already in a separate chunk that is non-causal (comes at
>>>>> the end of the stream), and I'm doomed.
>>>> Further experiments with varied clip durations, sadly show that the
>>>> above holds :(
>>>> Indeed, the produced .3gp files contain a few O(1) blocks (which
>>>> deserve the name of 'header' or 'trailer'), but also
>>>> unfortunately *two* O(N) blocks: 'mdat' for main bitstream, 'moov'
>>>> for extradata. There being more than one toplevel
>>>> chunk O(N) in size, with important data in both, wipes any hope of
>>>> live streaming. Good job, whoever designed that :/
>>>> -Alex
>>> Isn't the extradata the same if the encoder uses the same settings? What
>>> I'm getting at is that you could use a LUT of "supported" settings with
>>> corresponding extradata, and inject a few bytes before the 3GP stream
>>> starts telling which settings were used? I'm guessing you don't need a
>>> valid 3GP stream anyway (since one is nigh impossible to create).
>> Yes, I had hoped something along these lines, but it seems the extradata
>> are not constant, they are different for each frame. Essentially they
>> are just as unpredictable as frame data themselves.
> Again, I am not a 3GP or H.264 expert... But I believe the extradata are
> constant. I do not know why they are at the end of the 3GP file, but I
> think the codec generates them at the beginning, before generating any
> frame, and does not change them (if the video resolution or similar
> properties are not changed).

So the SPS/PPS are repeated endlessly (growing in O(N)) and constant ???

> I think you can use RTP (which is
> supported by the 3GP standards, if I remember well). If you use RTP, you
> can either interleave SPS and PPS in the stream, or encode it in the SDP
> (it's your choice).

In my case it's not an option. Android's MediaRecorder API only offers to save in a .3gp (or .mp4 which is similar) 
file, and I'm already cheating by passing it a TCP socket. But it does not allow RTP output :(


More information about the ffmpeg-devel mailing list