I'm having problems when I specify stream mapping options on my FFMPEG command line which just don't make sense, so I hope someone has some insight. I have searched the topic numerous ways, but every bit of documentation, hint, tip or solution I've found doesn't seem to solve the problem. I have been struggling with this for weeks now.
I'm using the latest build of FFMPEG
"Process started using FFmpeg SVN-r12665 [ffmpeg.v.12665]" and specifying user options in Avanti.
This is my input file:
Input #0, mpeg, from 'E:/DVDs/.../VTS_01.VOB':
Duration: 00:41:21.7, start: 0.287267, bitrate: 3566 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9],
8552 kb/s, 25.00 tb(r)
Stream #0.1[0x80]: Audio: liba52, 48000 Hz, 5:1, 384 kb/s
After specifying these user options in Avanti
-new -i "@source1" -dvs -qscale 1 -packetsize 2048 -muxrate 10080000 -mbd rd -cmp 2 -preme 1 -precmp 2 -subcmp 8 -mbcmp 8 -sws_flags spline -bf 1 -fflags genpts -strict very -f mpeg2video -aspect 16:9 -r 29.97 -s 720x480 -vpass -vlog -das -acodec ac3 -f vob -y "@destin1"
Avanti is creating this command line, also using the parameters specified in the Avanti GUI main page:
C:/Programs/Avanti/ffmpeg/ffmpeg.v.12665.exe -i "E:/DVDs/... /VTS_01.VOB" -vcodec mpeg2video -aspect 16:9 -s 720x480 -b 4000000 -minrate 2000000 -maxrate 9600000 -bufsize 1835000 -qscale 1 -packetsize 2048 -muxrate 10080000 -mbd rd -cmp 2 -preme 1 -precmp 2 -subcmp 8 -mbcmp 8 -sws_flags spline -bf 1 -fflags genpts -strict very -f mpeg2video -aspect 16:9 -r 29.97 -s 720x480 -pass 2 -passlogfile "E:/DVDs/ ... /VTS_01_1" -acodec ac3 -ab 384000 -ar 48000 -ac 2 -acodec ac3 -f vob -y "E:/DVDs/ ... /VTS_01_1.mpg"
which works fine. I get a high quality video/audio file, like so, which you'll notice has the stream mapping taken care of automatically:
Output #0, vob, to 'E:/DVDs/Lost_s01d03PAL/VTS_01_1.mpg':
Stream #0.0: Video: mpeg2video (hq), yuv420p, 720x480 [PAR 32:27 DAR 16:9],
q=2-31, pass 2, 4000 kb/s, 29.97 tb(c)
Stream #0.1: Audio: ac3, 48000 Hz, stereo, 384 kb/s
--------------------------------------------------------------------------
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Problem is, no matter where I put the mapping options in the command line (-map 0:0 -map 0:1) the conversion fails, with the message:
"Number of stream maps must match number of output streams"
I would like to not have to strip out all the other audio streams from the input file, leaving only the stream I actually want to keep, prior to doing the conversion.
I just need to know whether I'm doing something wrong, or if it is just a quirk or bug or fact of life that just has to be lived with.
Thank you, in advance, for any help that can be offered.
+ Reply to Thread
Results 1 to 7 of 7
-
-
Originally Posted by JackJack
First this. You added a few commands after the -new command that you can set at the main settings.
If you set the main settings to ac3, then they are already in -das (destination audio settings).
You also set -f mpeg2video and a bit later -f vob. FFmpeg will take the last one it finds into account (-f vob).
Frame rate, frame size and aspect ratio can also be set at the main settings so they will be in
-dvs (destination video settings) and you can leave them off to get a cleaner command line.
Actually just first set all main page basic settings (audio and video) to your wish, then enter:
-new -i "@source1" -dvs -qscale 1 -packetsize 2048 -muxrate 10080000 -mbd rd -cmp 2 -preme 1 -precmp 2 -subcmp 8 -mbcmp 8 -sws_flags spline -bf 1 -fflags genpts -strict very -vpass -vlog -f vob -das -y "@destin1"
with the -new command option and 2-pass (too automated yet. Has to be reconsidered).
EDIT: Currently the problem is that Avanti skips audio at the first pass and should also skip the user mapping.
I will change that in the next version. FFmpeg would not give the mapping error at pass 2 if it was able to reach that state.
For now, you can try the following, not using the -new option:
Load the NTSC_MPEG2_ES_DVD_30 template and set ES to PS. Then enter this on the command line:
-qscale 1 -packetsize 2048 -muxrate 10080000 -mbd rd -cmp 2 -preme 1 -precmp 2 -subcmp 8 -mbcmp 8 -sws_flags spline -bf 1 -fflags genpts -strict very -f vob -pass 1 -map 0:0 -map 0:X
EDIT: Now I see you have to go from PAL to NTSC. In that case you can use template PAL_TO_NTSC_ES_DVD_30
with the same procedure as above. This is the easiest way that allow to directly encode to mpg.
Better would be to convert from 25 to 23.976 fps m2v and then use soft flag 2:3 pulldown but then you
have to mux afterwards. FFmpeg is not capable to do pulldown on the fly.
I would like to not have to strip out all the other audio streams from the input file, leaving only the stream I actually want to keep, prior to doing the conversion.
where X = the number of the desired audio stream.
Nothing to do with stream mapping but I would use a more recent FFmpeg version.
http://arrozcru.no-ip.org/ffmpeg_builds
Chris. -
Found a work-around to still be able to use automatic 2-pass encoding.
Load the PAL_TO_NTSC_ES_DVD_30 template, set ES to PS and tweak the main page setting as you did.
Also set frame rate, frame size and aspect ratio on the main page.
Then enter this on the VIDEO command line without the -new command.
-qscale 1 -packetsize 2048 -muxrate 10080000 -mbd rd -cmp 2 -preme 1 -precmp 2 -subcmp 8 -mbcmp 8 -sws_flags spline -bf 1 -fflags genpts -strict very -f vob
Then do your mapping on the audio command line like e.g. -map 0:0 -map 0:3
The current Avanti version will omit the whole audio command line at the first pass.
I'm working on a permanent change for the new version.
Chris. -
Hi, Chris:
Wow! Thank you sooo much for the valuable information and the quick reply! I really appreciate the time you invested in explaining matters so clearly.
The first thing I took care of was to clean up the command line by deleting the redundant switches and letting the GUI take more control over the options.
I spent about 8 hours last evening experimenting with ffmpeg CLI options and changes. The info you provided really helped advance my understanding of ffmpeg and Avanti. Unfortunately, I tried so many new things and stayed up way too late, so that I'm not going to be able to be more specific about my findings, but I hope that others following this thread might benefit nevertheless by what I am going to write. I also hope that I'm not hijacking this thread or going off topic impermissably; I don't think I am, but if so, I apologize to the forum mods in advance.
I tried the newest version of Ffmpeg (ffmpeg-r13712) as per your suggestion. It threw some fatal errors and balked at the inclusion of -flags cgop and -flags2 sgop in the command line; Something about having to raise the "threshold" value to 1000000000 that I didn't understand, so I withdrew those options from my experimental commands. The gop options didn't seem to cure the warning messages that DVDLabPro was giving me about "open gops" anyway. Therefore, I went back to the build I started with for the time being.
Both ffmpeg builds under discussion seem to mess up the time codes when I encode to an elementary .m2v stream. They are seen by Media Player Classic, VLC and DGIndex as 1/2 to 1/4 their actual length. That causes me to worry about causing audio synch problems, so I usually leave at least one audio stream mixed in with my video source.
I haven't come to any conclusion about the .m2v audio synch yet because a number of the .m2v streams that I created were rejected by Muxman. I think they were the streams I created using the PAL 25fps --> NTSC 23.976fps option, intending to apply 3:2 pulldown afterwards. Those elementary streams were also rejected by the pulldown option in Avanti's tools. (Again, sorry that I can't recall more specifically than this.) The instances in which I was able to apply pulldown resulted in video streams with interlace artifacts in just about every frame, so I obviously don't know what I'm doing in that department.
The workarounds you suggested, using PAL_TO_NTSC_ES_DVD_30, leaving out the -new command and putting mapping on the Audio portion of the interface caused AVISynth to get involved with the conversion (as I'm sure you know) and disabled my command-line control over the conversions. Since I don't know much about AVISynth scripts right now, I'm going to leave that alone for the time being.
So, for the moment, I am encoding PAL 25fps progressive to NTSC 29.97 fps progressive and sacrificing a larger file size for the sake of outputting a progressive stream with no interlacing artifacts. Giving credit where credit is due, I wish to thank the creator of Batch DVD Streams Converter for the command line switches that I posted and which I am using as the jumping-off point for all my option-experimentation. That program also helped me tremendously in my attempts to figure out ffmpeg's command switches.
I'm eagerly looking forward to your release of Avanti with the updates and fixes you mentioned. Thank you again for your kind assistance, and thank you for providing everyone with the opportunity to use a tool such as Avanti to tame the wild beast that is the ffmpeg command-line. -
Originally Posted by JackJack
you really don;t need closed gops.
second:
the build you;re using doesn't work with -flags
there's a reason Chris suggested the build he did.
use it.
third:
the error message is explicit.
if you want closed gops, then disable scene change detection.
Code:-flags cgop -sc_threshold 1000000000
Originally Posted by JackJack
dgindex? and how exactly are you getting duration from dgindex?
Chris woked on avanti to get acurate reports of duration for elementary mpeg2 streams.
just load into Avanti and check clip properties.
Originally Posted by JackJack
from what i gather,
you want to do pal->ntsc.
preferred method:
encode at 25 fps.
take elementary encoded stream and pulldown from 25->29.97 fps with dgpulldown.
Originally Posted by JackJack
and of course 23.976 will not be accepted, illegal.
Originally Posted by JackJack
they're completely complementary.
what that does is a hard pulldown.
yes there'll be interlacing.
tripp"I'll give you five dollars if you let me throw a rock at you" -
Originally Posted by 45tripp
...
... and very useful, but to be slightly more specific for the concern of JackJack:
Re-encode the vob from 25 fps 720x576 to 25 fps 720x480
This doesn't need to insert Avisynth so mapping out the desired audio stream with
the -map commands on "User AUDIO options >" is fully available.
You can't use the Avanti pulldown because this only supports 23.976 to 29.97 fps.
I tried the whole procedure with DGPulldown and Muxman and audio is perfectly in sync.
BTW: Avanti hasn't have 384 kbps for the ac3 as default but if you type it in audio bitrate field
and press enter it will be added to the options.
EDIT:
You can probably also demux the desired audio stream with the same mapping method
and use the original stream.
Chris. -
Tripp:
I can't determine whether I said something to piss you off or you're just a man of few words. . .
Anyway, thank you for your help. I will review everything you and Chris posted. I have much to learn.
DGIndex pops up that Information box that has Status: Elapsed & Remain when you play/preview. I may have looked there for the duration info.
Similar Threads
-
Which ffmpeg options are used behind the scenes by ffmpeg?
By roberto.aloi in forum ffmpegX general discussionReplies: 1Last Post: 26th Jul 2011, 05:09 -
Avanti -FFmpeg Conversion to Transport stream
By manding74 in forum Video ConversionReplies: 20Last Post: 6th Jul 2011, 08:44 -
FFmpeg options ? Bad result on a standalone
By Umen Pich in forum Video ConversionReplies: 4Last Post: 18th Jan 2009, 09:28 -
[solved] FFMPEG Mapping Question
By Pixelartist in forum LinuxReplies: 5Last Post: 13th Nov 2007, 07:02 -
ffmpeg failure when using svcd2dvd
By cathalcelia in forum SVCD2DVD & VOB2MPGReplies: 26Last Post: 11th Oct 2007, 20:10