2

I'm trying to change a videos AR with ffmpeg like so:

ffmpeg -i in.mp4 -aspect 16:9 -c copy out.mp4

...and while this basically works, it loses a second audio stream that is present in the source, as well as subtitles. How can I do this without losing anything?

2 Answers 2

0

Map all streams

ffmpeg -i in.mp4 -aspect 16:9 -map 0 -c copy out.mp4

FFmpeg, by default, will pick only one video and audio stream from the source, without map.

-1

Use map parameter to select audio streams and copy streams by each stream separately. Example (please don't copy example as is in your command line with comments, you must remove comments first and format it as single line or connect lines breaks with \ symbol!):

ffmpeg -i input.mp4
    -map 0:0 -map 0:1  # Include both (2) audio streams  
    -aspect 16:9       # Change video aspect ratio
    -c:v copy          # Copy audio codec settings
    -c:a copy          # Copy audio codec settings
    -c:s copy          # Copy subtitles
    output.mp4

or

ffmpeg -i input.mp4
    -map 0:?           # Include all audio streams  
    -aspect 16:9       # Change video aspect ratio
    -c:v copy          # Copy audio codec settings
    -c:a copy          # Copy audio codec settings
    -c:s copy          # Copy subtitles
    output.mp4
1
  • -map 0:0 -map 0:1 doesn't include the two audio streams, it includes the stream #0 and the stream #1, whatever they are. -map 0:? doesn't include all audio streams per se, it includes all present streams. -c:s copy doesn't copy the subtitles, (one need some -map option for that) it just tells to copy them without transcoding.
    – PierU
    Sep 26, 2022 at 6:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .