5

I am converting an mkv h.264 video to HEVC. The file has two audio tracks. How can I copy all audio tracks?

I used this command (from a .bat file):

ffmpeg -i "!original!" -c:v libx265 -preset medium -crf 28 -c:a copy "g:\Prepare\Convert\!file!"

This exports only one audio track, but I always I need to copy all audio tracks.

2 Answers 2

8

Use

ffmpeg -i "!original!" \
    -map 0:v \
    -map 0:a \
    -c:v libx265 \
    -preset medium \
    -crf 28 \
    -c:a copy \
    "g:\Prepare\Convert\!file!"

FFmpeg by default only picks one video, audio and subtitle track (if they are present) from among the sources. Express map assignments are required in order to include other streams. 0:a selects all audio streams.

5

I have found that using -map 0 will select all tracks, including subtitles if available.

ffmpeg -i "!original!" -map 0 -c:v libx265 -preset medium -crf 28 -c:a copy "g:\Prepare\Convert\!file!"
1
  • Saved my day !!
    – Toodoo
    May 21, 2021 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.