View Full Version : FFmpeg - how do I encode a file with the same codec as another file?
nirpaudyal
1st October 2007, 16:05
Hi all.
Using FFmpeg, I need to encode a file with the codec and the properties (e.g. bit rate) of another file.
Namely there are three files - in.avi, out.avi and test.avi.
I need to create out.avi (which is a resized version of in.avi) and write it using the codec thats used on test.avi.
Any help would be amazing!
foxyshadis
1st October 2007, 19:38
To get the information on the input:
ffmpeg -i test.avi
To apply it to the output:
ffmpeg -i in.avi blahblahfilters -vcodec x -b v -acodec y -ab w -o out.avi
where the video codecs and bitrates all appear in the info command above. You might need to use -r fps if they have a different framerate.
If you need to, you can automate this with a series of windows or unix shell commands that I'm too tired to go over. @_@
nirpaudyal
1st October 2007, 20:45
foxyshadis, ta for your reply.
I do actually need this to be automated as I am writing a program via Visual Basic to run these commands on a command prompt window.
When you are less tired, perhaps you can tell me! thank you!
foxyshadis
1st October 2007, 23:01
VB or VB.Net? .Net has fantastic string libraries, you can easily capture the stdout and set up a few regular expressions to parse the output to set up the parameters for the new one. It's pretty ugly with old VB or shell commands.
Besides that, you'll probably have to check for certain names where the decoder doesn't match the encoder's name, as seen in ffmpeg -formats, and be sure to add extra quality switches for some formats (default settings for most are fast and low-quality). But that should be fairly simple logic.
Are you doing something where you swap out a game's FMV scenes? That's the only reason I can think of to require exactly the same format.
nirpaudyal
2nd October 2007, 16:48
I am actually using VB. Unfortunately. If you would be able to direct me to any resource for reading off a prompt window, It would be great!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.