Opened 13 years ago
Closed 13 years ago
#2427 closed defect (worksforme)
FFmpeg sets incorrect codec in output stream with multiple maps
| Reported by: | mt | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | ffmpeg |
| Version: | git-master | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug:
When transcoding FFmpeg incorrectly sets the audio codec with multiple maps. It simply takes the last one and applies it to all audio tracks.
All FFmpeg version from 0.9 are affected by this.
How to reproduce:
ffmpeg -i input.mkv -map 0:0 -vcodec copy -map 0:1 -acodec aac -map 0:2 -acodec alac test.m4v
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
built on Apr 2 2013 22:14:15 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
configuration:
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
Input #0, matroska,webm, from 'input.mkv':
Duration: 00:51:41.38, start: 0.000000, bitrate: 8640 kb/s
Stream #0:0: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(ger): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 768 kb/s (default) (forced)
Stream #0:2(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
[alac @ 0x7ffa6391b600] encoding as 24 bits-per-sample
[alac @ 0x7ffa6391bc00] encoding as 24 bits-per-sample
Output #0, ipod, to 'test.m4v':
Metadata:
encoder : Lavf54.63.104
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 16k tbn, 1k tbc (default)
Stream #0:1(ger): Audio: alac (alac / 0x63616C61), 48000 Hz, 5.1, s32p, 128 kb/s (default) (forced)
Stream #0:2(eng): Audio: alac (alac / 0x63616C61), 48000 Hz, 5.1, s32p, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (dca -> alac)
Stream #0:2 -> #0:2 (dca -> alac)
Change History (2)
comment:1 by , 13 years ago
| Reproduced by developer: | set |
|---|---|
| Status: | new → open |
| Summary: | FFmpeg sets incorrect audio codec in output stream with multiple maps → FFmpeg sets incorrect codec in output stream with multiple maps |
| Version: | unspecified → git-master |
comment:2 by , 13 years ago
| Reproduced by developer: | unset |
|---|---|
| Resolution: | → worksforme |
| Status: | open → closed |
(I suspect other users would have answered faster if you had asked on ffmpeg-users.)
You need to specify the audio stream number, this is explained on http://ffmpeg.org/ffmpeg.html#Main-options
For my command line, this would be:
$ ffmpeg -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -codec:v:0 mpeg1video -map 0:0 -codec:a:0 ac3 -map 0:1 -codec:v:1 flv -map 0:0 -codec:a:1 mp2 -map 0:1 -y out.avi
In your case, it is something like:
$ ffmpeg -i input.mkv -map 0:0 -vcodec copy -map 0:1 -codec:a:0 aac -map 0:2 -codec:a:1 alac test.m4v
Sorry for not realizing this earlier!



Not audio specific:
$ ffmpeg -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -vcodec mpeg1video -map 0:0 -acodec ac3 -map 0:1 -vcodec flv -map 0:0 -acodec mp2 -map 0:1 -y out.avi