[Libav-user] How to handle dynamically changing streams / parameters / codecs?

Andrea3000 andrea3000 at email.it
Sun Nov 4 16:08:59 CET 2012

> Andrea3000 <andrea3000 at ...> writes:
>> What do I need to update in the FFmpeg structure to 
>> handle the change?
> I suggest you first test ffmpeg (the command line application) 
> or ffplay (or MPlayer). If they do not support the changing of 
> number of audio / video streams or parameters (not bitrate, 
> since that changes all the time for real-world codecs), 
> consider reporting it here, on ffmpeg-users or on trac.

I have tested ffplay and MPlayer and both of them are not able to handle the changes is parameters (codec is the same).
But I don't think that this is a bug of ffmpeg, I think it simply requires some buffer flush and/or reset, performed on parameters change (my applicaton is responsible of doing this, not ffmpeg).

I try to better explain why I say this.

The change in stream parameters and streams number occures because custom ffmpeg I/O callbacks read two different movie files one after the other with seamless transition between the first and the second.
On file change, the application recieve a notification that informs it that next packets will come from the second file.

Xine media player has an implementation for this particular custom input as well as for this type of notification and performs a stream reset when it occurs. If I simply cat the two files and I try to load it with xine as a normal movie files, it gives me corrupted output after the parameters' change. (Like ffplay and MPlayer).
Therefore this suggests that I simply need to reset some FFmpeg buffers from within my application, but I actually don't know which one.

I've uploaded the two single files as well as the cat'ed version, you can find it here:
file1: https://dl.dropbox.com/u/11879013/file1.m2ts
file2: https://dl.dropbox.com/u/11879013/file2.m2ts
combined: https://dl.dropbox.com/u/11879013/combined.m2ts

Have you got any hint? Am I missing something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121104/f0109e1c/attachment.html>

More information about the Libav-user mailing list