[FFmpeg-user] Converting MPEG 2 issues

Moritz Barsnick barsnick at gmx.net
Mon Apr 2 15:00:49 EEST 2018


On Sun, Apr 01, 2018 at 03:22:10 +0200, rava77 at gmx.de wrote:
> I want to keep audio track 1 ("aid=1") and audio track 2 ("aid=2"), or how ffmpeg usually addresses these: "audio0 audio1"
> The other 2 audio tracks can be rejected / should not be added into the resulting mkv or ogv.

No problem.

> Here is how I tried creating the 30 seconds test video:
> __________
> 
> ffmpeg -y -v error -ss 1:15.500 -i capture_V0.mpg -map 0:0 -map 0:1 -c:a ac3 -codec copy -acodec copy -t 30 capture_V1_30s.mpg
> [mpeg @ 0x2540de0] Invalid media type data for output stream #0
> Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
> 
> $ ffmpeg -y -v error -ss 1:15.500 -i capture_V0.mpg -map 0 -codec copy -acodec copy -t 30 capture_V1_30s.mpg
> [mpeg @ 0x1a71b20] Invalid media type data for output stream #0
> Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
> 
> $ ffmpeg -y -v error -ss 1:15.500 -i capture_V0.mpg -map 0:0 -map 0:1 -codec copy -t 30 capture_V1_30s.mpg
> [mpeg @ 0xe5fae0] Invalid media type data for output stream #0
> Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

First of all, you need to should us the *complete* console output,
while omitting "-v error". Because when using this option, you are
surpressing all the valuable information.

Secondly, your command lines are a bit confusing:
$ [...] -c:a ac3 -codec copy -acodec copy
             ^^^
Do you want to (re-)encode your audio to ac3, or do you want to keep it
(copy)?

Thirdly:
$ [...] -map 0:0 -map 0:1
will map streams 0 and 1 from your file. Presumably the video track and
the first audio track. If you want the first *two* audio tracks, you
probably need to add "-map 0:2", or you do
$ [...] -map 0:v -map 0:a:0 -map 0:a:1

> That /looks/ like it did work… but there is no audio track in the resulting 30 seconds test video:

Again, you need to show us the console output *without -v error*. You
are hiding all the information about your input files and the process
from us.

Moritz


More information about the ffmpeg-user mailing list