Tuesday, January 1, 2013

Deprecated functions in ffmpeg library

Well, I have some code that uses some old FFMPEG library, and now, as I updated my laptop to Fedora 18, it turns out that those functions are gone for good. I found some resources about how to port old code (here, here and here), but since it wasn't what I needed I decided to write my own version. So, here we go.


This function has been changed to avio_open. There is also url_close which is renamed to avio_close. This information I found here.


This function is still supported as of FFMPEG 1.0.1 but it is marked as deprecated. It will be replaced with avformat_new_stream(). Suppose that the old code was:
AVStream *st = av_new_stream(oc, i);
the modified code should be:
AVStream *st = avformat_new_stream(oc, NULL);
st->id = i
Be careful to check first that st isn't NULL!


This function was renamed to av_dump_format().


Replaced with avformat_write_header() that accepts two arguments instead of one. Pass NULL as the second argument to get identical behavior to the old function.


This one is replaced with av_codec_open2(). The replacement function accepts three arguments instead of two, but put NULL as a third argument to get the same behavior as the old function.


Replaced with avcodec_encode_audio2().


I couldn't fine the replacement for this one. First, I've found that this function doesn't have replacement. But it was when it was still available in FFMPEG, even though deprecated. Then, they removed it, and thus it has to have replacement. In certain places I found that they only disabled it, on others that its parameters have to be passed  to avformat_write_header. In the end, I gave up because I didn't need working version of that part of the code for now. Since in my case avformat_alloc_context() is called and then av_set_parameters(), last what I looked at was to call avformat_alloc_output_context2() instead of avformat_alloc_context(). But the change is not trivial so I skipped it.


This enum has been renamed AVSampleFormat.


This constant has been replaced with AVIO_FLAG_WRITE.


Those are prefixed now with AV_, so use AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16, etc.


Unknown said...

Hi, thanks for this listing. It was very helpful even after a year!

concerning av_set_parameters I have found some hint in ffmpegs documentation for version 0.8 in which it was marked as deprecated:

It exactly says:
"Global av_set_parameters
pass the options to avformat_write_header directly."

That's it.


Unknown said...
This comment has been removed by the author.

About Me

scientist, consultant, security specialist, networking guy, system administrator, philosopher ;)

Blog Archive