Posted: Sun Mar 04, 2012 1:33 am Post subject: Checking for FFmpeg API version
I have been thinking about the continual changes that FFmpeg has been making to their API lately (and the eventual dropping of deprecated functions) and I think it would be a good thing to start checking against FFmpeg's libavcodec version (Here is a nice API Changes page showing each increment). As there is no control on which FFmpeg binary someone uses this will eventually become a major issue for pyTivo support.
I have started work on implementing something like this and wanted to get some opinions from others on the most efficient ways to go about this. I figure two ways to go about this would be:
A: To return 'int(avcodecVer[attr])' (ex: avcodecVer['libavcodecMAJ'] = 54) and have each function compare the necessary versions as they are needed
B. To set a global 'ffmpeg_level' and keep increasing the value as additional tests are added to a 'ffmpeg_check()' function with new FFmpeg API changes. Ex:
if libavcodecMAJ >= 54:
ffmpeg_level = 2
Then the individual transcode functions would only have to check what the supported 'ffmpeg_level' was and change it's output accordingly.
I already have the code to read the major and minor version of libavcodec…something similar to this:
hmmm...OK well anyways I have gone ahead and implemented something similar to the above in my fork. Added to vInfo which now returns ['avcodecMAJ'] and ['avcodecMIN'] as integers. I did not add a check for micro versions but that could be done easily enough.
Anytime you have a feature to implement that is not supported by older versions of libavcodec (everything that pyTivo works with) you can just do a simple comparison for the API level you are looking for. There are a couple lines of code in use that I can think of already that could make use of this.
Ex: FFmpeg 0.10 libavcodec version is:
['avcodecMAJ'] = 53
['avcodecMIN'] = 60
Eventually I will get around to using this as a method for outputting different FFmpeg parameters as many in use are deprecated now.
As a proof in concept I have removed wmcbrine's pad_style checks and function in my forks replaced with a check for lavfiVer >= 2.0. Works fine. _________________ My pyTivo fork - Read link for changes
FFmpeg for OS X
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum