Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th July 2011, 15:45   #1  |  Link
galfwender
Registered User
 
Join Date: May 2007
Posts: 9
ffmpeg syntax

Hi,

I am trying to use ffmpeg to remux a transport stream into a mkv with only the video track, and a separate ac3.

I can't find the correct syntax, it always assumes the mkv must have an audio track. I have tried -an to disable audio processing in the mkv and then -newaudio to create the new ac3, and also tried manual mapping of tracks, but can't find any combination that works.

Can anyone help?

ffmpeg -i input.ts -vcodec copy video.mkv -acodec copy audio.ac3 - this produces a mkv with both audio and video and a separate ac3

ffmpeg -i input.ts -vcodec copy -an video.mkv -acodec copy audio.ac3 - this will not make the audio as audio has been disabled globally

ffmpeg -i input.ts -vcodec copy -an video.mkv -acodec copy audio.ac3 -newaudio - this does the same as example 1

ffmpeg -i input.ts -vcodec copy video.mkv -acodec copy audio.ac3 -map 0.0 -map 0.1 - this complains that number of stream maps does not match number of output streams as it is assuming the mkv has two streams
galfwender is offline   Reply With Quote
Old 25th July 2011, 15:48   #2  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,769
Why don't you use MKV-specific tools to obtain an MKV?
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Old 25th July 2011, 15:55   #3  |  Link
galfwender
Registered User
 
Join Date: May 2007
Posts: 9
Quote:
Originally Posted by Ghitulescu View Post
Why don't you use MKV-specific tools to obtain an MKV?
Because I plan to expand upon the command above with other ffmpeg features but I need this working first.
galfwender is offline   Reply With Quote
Old 4th August 2011, 04:30   #4  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
from near incessant googling, i'm coming to the conclusion that there's actually nobody on the internet (ffmpeg/libav devs included) that know how to use ffmpeg and are willing to share their knowledge.

the man pages are absolutely woeful.

the guides out there usually only handle the case of transcoding low res crap into avi with mp3 audio...

now, this rant is not completely self-indulgent. i'll post any command lines that expand on what's out there as i find them.

i think, with the ffmpeg/libav schism, whoever comes up with usable docs first will be the one adopted by the community.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 13th August 2011, 08:31   #5  |  Link
blis
Registered User
 
Join Date: Jun 2011
Posts: 7
What's the problem?

Quote:
Originally Posted by Mug Funky View Post
from near incessant googling, i'm coming to the conclusion that there's actually nobody on the internet (ffmpeg/libav devs included) that know how to use ffmpeg and are willing to share their knowledge.

the man pages are absolutely woeful.

the guides out there usually only handle the case of transcoding low res crap into avi with mp3 audio...

now, this rant is not completely self-indulgent. i'll post any command lines that expand on what's out there as i find them.

i think, with the ffmpeg/libav schism, whoever comes up with usable docs first will be the one adopted by the community.
I use it on a daily basis... It's very powerful and can be very simple. More often than not I use AviSynth to frameserv to it. There are certain distributions that fail, but for the most part it is the most valuable tool I use.
blis is offline   Reply With Quote
Old 13th August 2011, 08:32   #6  |  Link
blis
Registered User
 
Join Date: Jun 2011
Posts: 7
Quote:
Originally Posted by galfwender View Post
Hi,

I am trying to use ffmpeg to remux a transport stream into a mkv with only the video track, and a separate ac3.

I can't find the correct syntax, it always assumes the mkv must have an audio track. I have tried -an to disable audio processing in the mkv and then -newaudio to create the new ac3, and also tried manual mapping of tracks, but can't find any combination that works.

Can anyone help?

ffmpeg -i input.ts -vcodec copy video.mkv -acodec copy audio.ac3 - this produces a mkv with both audio and video and a separate ac3

ffmpeg -i input.ts -vcodec copy -an video.mkv -acodec copy audio.ac3 - this will not make the audio as audio has been disabled globally

ffmpeg -i input.ts -vcodec copy -an video.mkv -acodec copy audio.ac3 -newaudio - this does the same as example 1

ffmpeg -i input.ts -vcodec copy video.mkv -acodec copy audio.ac3 -map 0.0 -map 0.1 - this complains that number of stream maps does not match number of output streams as it is assuming the mkv has two streams
I'd use avisynth to mux them and frameserv to ffmpeg. (did not notice the last line..)

Last edited by blis; 13th August 2011 at 08:36.
blis is offline   Reply With Quote
Old 24th August 2011, 13:02   #7  |  Link
ronnylov
Registered User
 
Join Date: Feb 2002
Location: Borås, Sweden
Posts: 492
The number of input streams must match the number of output streams. With -map you select the input streams you want to use for your output.
First test your input stream to find out the stream mapping:
Code:
ffmpeg -i input.ts
The output should show you which streams are available in your input.ts file. Let's say that the video stream is stream #0.0
The ac3 file is just one single stream so it should be stream #1.0 (the fist input file includes streams 0.x and second inout 1.x and so on)
So maybe something like this will select video stream from first file and audio stream form second file:
Code:
ffmpeg -i input.ts -i audio.ac3 -map 0:0 -map 1:0 -vcodec copy -acodec copy output.mkv
Or if you want two audio tracks, one from the input.ts file and the second audio from the ac3 file, assuming the first audio stream from the input.ts was stream #0.1:
Code:
ffmpeg -i input.ts -i audio.ac3 -map 0:0 -map 0:1 -map 1:0 -vcodec copy -acodec copy output.mkv
I might remember wrong regarding the stream numbering but at least you should have a starting point to find out how to do it.
Perhaps you need -acodec copy two times when dealing with two audio streams. Do some tests and see what happens.
__________________
Ronny

Last edited by ronnylov; 24th August 2011 at 13:05.
ronnylov is offline   Reply With Quote
Old 2nd September 2011, 04:27   #8  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
Quote:
Originally Posted by blis View Post
I use it on a daily basis... It's very powerful and can be very simple. More often than not I use AviSynth to frameserv to it. There are certain distributions that fail, but for the most part it is the most valuable tool I use.
i use it every day too, hence my bewilderment. read my post again.

it's very difficult penetrating the manuals - i almost always resort to opening a terminal and just spamming it with every combination i can think of until either it works or i conclude (possibly erroneously) that ffmpeg is unable to do it.

avconv's new syntax looks promising, and also helped me infer some of the mysteries of ffmpeg's syntax.

my gripe is that people who know ffmpeg intimately (such as yourself) seem unable to communicate their knowledge. you could prove me wrong by solving the OP's problem, though.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 6th September 2011, 08:38   #9  |  Link
shroomM
Registered User
 
Join Date: Dec 2005
Location: Slovenia
Posts: 55
Using libav / avconv (http://libav.org/), this works for me...

avconv -i a.ts -c copy -map 0:0 video.mkv -map 0:1 audio.mp2

Some info on CLI can be seen on the front page of libav, under news
shroomM is offline   Reply With Quote
Reply

Tags
ffmpeg


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:21.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.