问题
If I import a file to use with ffmpeg but dont specify anything about the codecs of any of the streams, will ffmpeg do anything? Is the default action to just copy the codecs? Or will ffmpeg encode the input file using some default codec?
Would the following two commands be the same? Or will the second re-encode and take ages?
ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4
ffmpeg -i input.mkv output.mp4
回答1:
If I import a file to use with ffmpeg but dont specify anything about the codecs of any of the streams, will ffmpeg do anything?
ffmpeg will re-encode each stream in the input using default encoders. The encoders used will depend on how you configured ffmpeg. For example, if available libx264
will be the default encoder for mp4 output, but if not then mpeg4
will be used. By default ffmpeg will only re-encode one stream of each type and will ignore the rest (see stream selection).
Of your two commands the first one will use stream copy mode for the video and audio. Your second command will re-encode.
回答2:
To discover the default codecs (both audio and video) used by the second command, on your computer:
Run the second command, perhaps with
-t 5
so it finishes faster (encode only 5 seconds).Run
ffprobe output.mp4
. Scan the output for "Video" and "Audio" to see which codecs ended up being used. For example, my Ubuntu 12 installation uses h264 and aac.
来源:https://stackoverflow.com/questions/17793150/default-ffmpeg-codec-when-nothing-is-specified