Hi,
I record movies from the TV, and here they usually come with two audio
channels, two languages. And not always in the same order.
Like this (according to mediainfo):
....
Audio #1
ID : 192 (0xC0)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Duration : 1h 59mn
Bit rate mode : Constant
Bit rate : 96.0 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Delay relative to video : -170ms
Stream size : 81.9 MiB (3%)
Audio #2
ID : 193 (0xC1)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Duration : 1h 59mn
Bit rate mode : Constant
Bit rate : 64.0 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Compression mode : Lossy
Delay relative to video : -90ms
Stream size : 54.6 MiB (2%)
Audio #3
ID : 194 (0xC2)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Duration : 1h 59mn
Bit rate mode : Constant
Bit rate : 192 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Delay relative to video : -210ms
Stream size : 164 MiB (6%)
Audio #1 is in English
Audio #2 is mute
Audio #3 is Spanish
I know how to reorder them, so that I get English, Spanish, and remove
the mute one (no idea why it is there). But I think it is possible to
add the language somewhere, because I have seen videos with the language
name instead of audio 1 or 2.
In the ffmpeg manual I found this entry:
-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
So I’m doing, after several tests:
cer@Telcontar:~> ffmpeg -i SOMEMOVIE.mpg \
-metadata:s:a:0 language=spa -metadata:s:a:1 language=end \
-map 0:3 -map 0:1 -acodec copy -map 0:0 \
-vcodec copy -fs 400000000 0_31.mpg
ffmpeg version 2.2.4 Copyright (c) 2000-2014 the FFmpeg developers
built on Jun 29 2014 12:04:05 with gcc 4.8 (SUSE Linux)
.... trimmed for clarity
Input #0, mpeg, from 'LA PESCA DE SALMON EN YEMEN (20140911).mpg':
Duration: 01:59:17.73, start: 1129.023856, bitrate: 3128 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576
[SAR 64:45 DAR 16:9], max. 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 96 kb/s
Stream #0:2[0x1c1]: Audio: mp2, 48000 Hz, mono, s16p, 64 kb/s
Stream #0:3[0x1c2]: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s
File '0_31.mpg' already exists. Overwrite ? [y/N] y
Output #0, mpeg, to '0_31.mpg':
Metadata:
encoder : Lavf55.33.100
Stream #0:0(spa): Audio: mp2, 48000 Hz, stereo, 192 kb/s
Stream #0:1(end): Audio: mp2, 48000 Hz, stereo, 96 kb/s
Stream #0:2: Video: mpeg2video, yuv420p, 720x576 [SAR 64:45 DAR
16:9], q=2-31, max. 15000 kb/s, 25 fps, 90k tbn, 25 tbc
Stream mapping:
Stream #0:3 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #0:0 -> #0:2 (copy)
Press [q] to stop, ?] for help
frame=21105 fps=13385 q=-1.0 Lsize= 390742kB time=00:14:04.29
bitrate=3791.3kbits/s
video:359154kB audio:29674kB subtitle:0 data:0 global headers:0kB muxing
overhead 0.492272%
cer@Telcontar:~/Moria/Convertidos/NewItems>
So you see, the streams above are labelled correctly:
Stream #0:0(spa): Audio: mp2, 48000 Hz, stereo, 192 kb/s
Stream #0:1(end): Audio: mp2, 48000 Hz, stereo, 96 kb/s
But neither VLC, Xine, mediainfo… see it at all.
Am I doing it wrong? Should I try another program? One that only changes
the tags or however they are called, not the coding.
–
Cheers / Saludos,
Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)