1
votes

I am trying to transcode a single video file with 1 video stream and several audio streams to the file having same video stream in different bitrates/sizes with correct padding at the same time.

the command I use is:

    ffmpeg -y -ss 600 -t 600 -i "INPUT.mkv" -map_chapters -1 -map 0:0 -c:v libx264 -keyint_min 48 -g 96 -bufsize 350k -b:v 350k -minrate 300k -maxrate 400k -profile:v baseline -level 3.0 -preset slow -vf "scale=iw*min(480/iw\,272/ih):ih*min(480/iw\,272/ih),pad=480:272:(480-iw)/2:(272-ih)/2" -map 0:0 -c:v libx264 -keyint_min 48 -g 96 -bufsize 650k -b:v 650k -minrate 500k -maxrate 800k -profile:v baseline -level 3.1 -preset slow -vf "scale=iw*min(640/iw\,360/ih):ih*min(640/iw\,360/ih),pad=640:360:(640-iw)/2:(360-ih)/2" -map 0:1 -c:a libfaac -b:a 32k -ar 44100 -f mpegts OUTPUT.m2ts

ffmpeg creates two video streams, however the bitrate and resolution for all of them are taken from the last video arguments - i.e. both streams are 640x360:

    Output #0, mpegts, to 'OUTPUT.m2ts':
    Stream #0:0(eng): Video: h264, yuv420p, 640x360 [SAR 559:560 DAR 559:315], q=-1--1, 650 kb/s,     Stream #0:1(eng): Video: h264, yuv420p, 640x360 [SAR 559:560 DAR 559:315], q=-1--1, 650 kb/s, 90k tbn, 23.98 tbc (default)
    Stream #0:2(rus): Audio: aac, 44100 Hz, 5.1, s16, 32 kb/s (default)
    Stream mapping:
    Stream #0:0 -> #0:0 (h264 -> libx264)
    Stream #0:0 -> #0:1 (h264 -> libx264)
    Stream #0:1 -> #0:2 (aac -> libfaac)
    Press [q] to stop, [?] for help

Is it practically possible to make transcoding to several bitrates to the same file?

2

2 Answers

2
votes

You are mapping your input, but not your output. Try to specify your output bitrate like this: -b:v:0 350k and -b:v:1 650k. Also the other streams and variables like codecs can be defined this way. See FFmpeg map wiki for more info and examples.

0
votes

Try this command:

ffmpeg -y -ss 600 -t 600 -i "INPUT.mkv" -map_chapters -1 -map 0:0 -map 0:0  -map 0:1 -c:v:0 libx264 -keyint_min 48 -g 96 -bufsize 350k -b:v0 350k -minrate 300k -maxrate 400k -profile:v:0 baseline -level 3.0 -preset slow -vf "scale=iw*min(480/iw\,272/ih):ih*min(480/iw\,272/ih),pad=480:272:(480-iw)/2:(272-ih)/2" -c:v:1 libx264 -keyint_min 48 -g 96 -bufsize 650k -b:v1 650k -minrate 500k -maxrate 800k -profile:v:1 baseline -level 3.1 -preset slow -vf "scale=iw*min(640/iw\,360/ih):ih*min(640/iw\,360/ih),pad=640:360:(640-iw)/2:(360-ih)/2" -c:a libfaac -b:a 32k -ar 44100 -f mpegts OUTPUT.m2ts