video - How to make FFmpeg use output codec and pix_fmt same with input -


i'm trying write batch process shell script resizing videos, of unpredictable codecs , containers. expected resized video should same original 1 except image sizes. means video png codec in mov container should output png codec not h264.

but realized keeping extension names same not enough. ffmpeg tends use default encoder associated extension name rather trying keep same input.

is there magical parameter tell ffmpeg try use input codec instead of guessing output file name?

running ffmpeg twice information in advance last choice, because make script lot more complicated.

get codecs ffprobe, , specify them on ffmpeg command, pseudocode like:

output = parse_json( `ffprobe -v quiet -show_streams -print_format json output.mp4` ) stream_args = "" stream in output['streams']:     stream_args += " -codec:0:" + stream['index'] + " " + stream['codec_name']  ffmpeg_cmd = "ffmpeg -i input.mp4 " + stream_args + " output.mp4 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -