How do I name an audio track with ffmpeg

Solution 1:

You can apply metadata to particular streams. This example will add title and language metadata to audio streams/tracks 1 & 2 (note ffmpeg starts counting from 0).

ffmpeg -i input.mp4 -map 0 -c copy -metadata:s:a:0 title="One" -metadata:s:a:1 title="Two" -metadata:s:a:0 language=eng -metadata:s:a:1 language=spa output.mp4
  • -map 0 selects all streams from input.mp4, otherwise default stream selection behavior chooses only 1 stream per stream type.

  • -c copy enables stream copy mode to avoid re-encoding.

  • -metadata:s:a:0 title="One" sets title One to audio 0.

  • -metadata:s:a:1 title="Two" sets title Two to audio 1.

  • -metadata:s:a:0 language=eng sets English language for audio 0.

  • -metadata:s:a:1 language=spa sets Spanish language for audio 1.

For more info look for -metadata and -map_metadata in the documentation.