Is there a way to change the order of sound tracks in an mpeg file?

Hi,

I have a digital recording device, to save to file a TV program (Siemens
Gigaset M740AV). Sometimes I process the recording to remove the
“interruptions” (using cridmanager and projectX). The result is an mpeg
file:


Format                                   : MPEG-PS
File size                                : 719 MiB
Duration                                 : 42mn 59s
Overall bit rate mode                    : Variable
Overall bit rate                         : 2 337 Kbps

Video
ID                                       : 224 (0xE0)
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@Main
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Custom
Format settings, GOP                     : Variable
Duration                                 : 42mn 58s
Bit rate mode                            : Variable
Bit rate                                 : 2 003 Kbps
Maximum bit rate                         : 15.0 Mbps
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 25.000 fps
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.193
Stream size                              : 615 MiB (86%)


Audio #1
ID                                       : 192 (0xC0)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Duration                                 : 42mn 59s
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                  : -1s 609ms
Stream size                              : 29.5 MiB (4%)

Audio #2
ID                                       : 193 (0xC1)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Duration                                 : 42mn 59s
Bit rate mode                            : Constant
Bit rate                                 : 128 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Delay relative to video                  : -1s 609ms
Stream size                              : 39.4 MiB (5%)

Audio #3
ID                                       : 194 (0xC2)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Duration                                 : 42mn 59s
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                  : -1s 489ms
Stream size                              : 19.7 MiB (3%)

Audio 1 is English, Audio 2 is Spanish, 3 doesn’t play.

Problem #1: the audio channels are reversed to what they play in the TV,
meaning that if I play it on the the TV it plays in English. I want it
in Spanish.

Problem #2: The TV refuses to allow me to choose language.

Thus, to watch it in Spanish, I have to do so on the computer, meaning I
can’t use the computer for much else.

What I want to know is if it is possible to relabel track 2 as track 1,
without any kind of recoding. Or change the default sound channel somehow.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Carlos E. R. wrote:

> What I want to know is if it is possible to relabel track 2 as track 1,
> without any kind of recoding. Or change the default sound channel somehow.
>
Create video with one audio channel:-
you can try something like this
http://ubuntuforums.org/showthread.php?t=1148243&s=f9d16d70a80aeedd639c30ea81efda57&p=7212079#post7212079

GNOME 3.10.1
openSUSE 13.1 (Bottle) (x86_64) 64-bit
Kernel Linux 3.11.6-4-desktop

On 2013-12-04 01:53, vazhavandan wrote:
> Carlos E. R. wrote:
>
>> What I want to know is if it is possible to relabel track 2 as track 1,
>> without any kind of recoding. Or change the default sound channel
>> somehow.
>>
> Create video with one audio channel:-
> you can try something like this
> http://ubuntuforums.org/showthread.php?t=1148243&s=f9d16d70a80aeedd639c30ea81efda57&p=7212079#post7212079

Interesting.

But it doesn’t quite work. I did:


> ffmpeg -i p.mpg -map 0:1 -map 0:2 -acodec copy -vcodec copy p2.mpg

The source had 781282287 bytes, the destination got 67594240. There is
no video, and the audio has the channels in the same order, ie, it plays
in English.

This other version:


>  ffmpeg -i p.mpg -map 0:2 -map 0:1 -acodec copy -vcodec copy p2.mpg

gets the audio right, but still no video; I thought that could be the
“-vcodec copy” thing.

Got it:


> ffmpeg -i p.mpg -map 0:2 -map 0:1 -acodec copy -map 0:0 -vcodec copy p2.mpg

This is the key for the mapping:


> File 'p2.mpg' already exists. Overwrite ? [y/N] y
> Output #0, mpeg, to 'p2.mpg':
>   Metadata:
>     encoder         : Lavf55.19.104
>     Stream #0:0: Audio: mp2, 48000 Hz, stereo, 128 kb/s
>     Stream #0:1: Audio: mp2, 48000 Hz, stereo, 96 kb/s
>     Stream #0:2: Video: mpeg2video, yuv420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, max. 15000 kb/s, 25 fps, 90k tbn, 25 tbc
> Stream mapping:
>   Stream #0:2 -> #0:0 (copy)
>   Stream #0:1 -> #0:1 (copy)
>   Stream #0:0 -> #0:2 (copy)

Good, thanks!!

Last time I tried this it was a total failure. I used avidemux, I think.
I can script this to make it easy to use.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)