FFMPEG Track Number not written

1

How can I write the track number when re-encoding an audio file using ffmpeg? Currently, I have the following command:

ffmpeg -i "in.wav" -acodec libmp3lame -aq 0 -id3v2_version 3 -write_id3v1 1 "out.mp3"

but the only tag that is not written is the track number.

Steve

Posted 2013-12-30T15:05:42.437

Reputation: 113

You should always include your complete ffmpeg console output too. – llogan – 2013-12-30T18:31:40.320

Answers

2

The metadata parameter:

ffmpeg -i "in.wav" -acodec libmp3lame -aq 0 -metadata track="X/Y" -id3v2_version 3 -write_id3v1 1 "out.mp3"

Where X is the number of the track, out of Y total tracks.

‘-metadata[:metadata_specifier] key=value (output,per-metadata)

Set a metadata key/value pair.

An optional metadata_specifier may be given to set metadata on streams or chapters. See -map_metadata documentation for details.

This option overrides metadata set with -map_metadata. It is also possible to delete metadata by using an empty value.

For example, for setting the title in the output file:

ffmpeg -i in.avi -metadata title="my title" out.flv

To set the language of the first audio stream:

ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT

Source: FFmpeg documentation, paragraph 5.4 "Main Options"

Thor

Posted 2013-12-30T15:05:42.437

Reputation: 3 562

Thanks for that. Any reason why it's not automatically transferred like the other tags? – Steve – 2013-12-30T16:19:02.740

@StevenFrost Hard to say without speculating; maybe there's some invalid data in there that it cannot parse? I haven't looked at depth how FFmpeg extracts the metadata already present, sorry! – Thor – 2013-12-30T16:20:21.580

Ah ok, thanks for the alternative anyway :-) – Steve – 2013-12-30T16:29:21.640