19
7
I wished to be able do this multiple times now so I ask.
If I have an existing video or audio file, ffmpeg
, mplayer
and other media players can detect at least some of it's "propreties" like container, codec and bitrate used, probably various quality and encoding specific settings, etc.
How can I extract these settings from an existing file in order to use them (directly) for encoding with ffmpeg?
For example, I got an mkv
video encoded with x264
with some settings, and another uncompressed avi
file. I would like to "copy" the encoding settings used in for x264 mkv file to transcode the avi with the same settings.
Note: I'm looking for a way that should include no human work with "translating" the settings from a decoder to the encoder. It is okay if I need to extract the settings first and save it somewhere but I would like to be able to simply feed the read options to a command line or preset|configuration file for ffmpeg.
I can't find anything about encoding settings in ffprobe's output :( – thelolcat – 2015-12-03T18:01:40.877
It only shows the number of ReFrames, but not the other settings like mediainfo does – thelolcat – 2015-12-03T18:02:25.700
Input syntax with ffmpeg is different from the metadata fields. e.g. you could read
channels:6
from a video file, but to encode it you'd need to use the switch-ch:6
. Some switches use 1 letter, some use two, etc. – jiggunjer – 2015-12-09T02:49:35.997Well, you could probably sort through the output of
ffprobe
(especially with the-show_streams
and-show_format
options) and use that information to script the important stuff – evilsoup – 2013-04-01T11:42:08.5001
Often using the same settings, such as bitrate (attempting to copy exact bitrate seems to be popular among users), will not result in optimal quality. Of course I have no clue what your typical input is like, but with x264 usage of the
– llogan – 2013-04-01T18:14:46.390-crf
option is generally recommended. See the FFmpeg and x264 Encoding Guide.