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 > General > Linux, Mac OS X, & Co

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd March 2018, 20:16   #1  |  Link
ravs
Registered User
 
Join Date: Nov 2010
Posts: 15
Convert multi language DVD using ffmpeg

I try to convert a multi language DVD movie into an mkv or ogv video, with the first 2 audio tracks using ffmpeg.

I copied the VOBs of a DVD to the harddrive (using MS-W and ripit4me and DVDDecrypter since I cannot get it to work on Linux alone, I tried installing libdvdcss-1.4.0-x86_64 but the VOBs are still not readable, not even for the "file" command. See also here: http://forum.doom9.org/showthread.php?=t=1753332 )

This is the info I get via playing the merged VOB files of the main video
(I merged the main VOBs into one single VOB file using "cat Whatever*.VOB > P_V0.VOB" and played it via mpv to get the below info)
Code:
Playing: P_V0.VOB
 (+) Video --vid=1 (mpeg2video 720x576 25.000fps)
     Subs  --sid=1 (dvd_subtitle)
     Subs  --sid=2 (dvd_subtitle)
VO: [opengl] 720x576 => 1024x576 yuv420p
 (+) Video --vid=1 (mpeg2video 720x576 25.000fps)
     Audio --aid=1 (ac3 6ch 48000Hz)
     Audio --aid=2 (ac3 6ch 48000Hz)
     Audio --aid=3 (ac3 6ch 48000Hz)
     Audio --aid=4 (ac3 2ch 48000Hz)
     Subs  --sid=1 (dvd_subtitle)
     Subs  --sid=2 (dvd_subtitle)
     Subs  --sid=3 (dvd_subtitle)
 (+) Video --vid=1 (mpeg2video 720x576 25.000fps)
     Audio --aid=1 (ac3 6ch 48000Hz)
     Audio --aid=2 (ac3 6ch 48000Hz)
     Audio --aid=3 (ac3 6ch 48000Hz)
     Audio --aid=4 (ac3 2ch 48000Hz)
     Subs  --sid=1 (dvd_subtitle)
     Subs  --sid=2 (dvd_subtitle)
     Subs  --sid=3 (dvd_subtitle)
     Subs  --sid=4 (dvd_subtitle)
     Subs  --sid=5 (dvd_subtitle)
     Subs  --sid=6 (dvd_subtitle)
V: 00:00:04 / 00:00:00 (0%) Cache: 14s+73MB
Invalid video timestamp: 4.920000 -> -0.033367
V: 00:00:03 / 00:00:00 (0%) Cache: 11s+73MB
Track switched:
 (+) Video --vid=1 (mpeg2video 720x576 25.000fps)
 (+) Audio --aid=1 (ac3 6ch 48000Hz)
     Audio --aid=2 (ac3 6ch 48000Hz)
     Audio --aid=3 (ac3 6ch 48000Hz)
     Audio --aid=4 (ac3 2ch 48000Hz)
     Subs  --sid=1 (dvd_subtitle)
     Subs  --sid=2 (dvd_subtitle)
     Subs  --sid=3 (dvd_subtitle)
     Subs  --sid=4 (dvd_subtitle)
     Subs  --sid=5 (dvd_subtitle)
     Subs  --sid=6 (dvd_subtitle)
These are the audio tracks, and I want to only keep audio0 and audio1:
Code:
Audio --aid=1 (ac3 6ch 48000Hz)	ENG  <- KEEP!		map:0
Audio --aid=2 (ac3 6ch 48000Hz) DEU  <- KEEP!		map:1
Audio --aid=3 (ac3 6ch 48000Hz) jap
Audio --aid=4 (ac3 2ch 48000Hz) jap-Audio-Commentary
(I did add the info after the Hz entry, that was not part of the info by mpv)

I try to first cut off some stuff at the beginning ( "-ss 1:15.500" ), and create a 30 seconds test sample to see if ffmpeg gets it all right, especially in adding the two audio tracks. I first want a stream copy with includes the main video (video0) and the first two audio tracks (audio0 = ENG and audio1 = DEU). But I seem not to be able to get it right, I read the ffmpeg documentation ( http://ffmpeg.org//ffmpeg.html ), and also some posts about mapping on superuser.com and video.stackexchange.com, but so far to no prevail.

Code:
ffmpeg -y -v error -ss 1:15.500 -i P_V0.VOB -map 0:0 -map 0:1 -c:a ac3 -codec copy -acodec copy -t 30 P_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 P_V0.VOB -map 0 -codec copy -acodec copy -t 30 P_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 P_V0.VOB -map 0:0 -map 0:1 -codec copy -t 30 P_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
Code:
time ffmpeg -y -v error -ss 1:15.500 -i P_V0.VOB  -codec copy  -t 30 P_V1_30s.mpg

real	0m3.239s
user	0m0.915s
sys	0m0.815s
That seemed to have worked, but… there is no audio. Unlike the ffmpeg documentation which says, unless you use the -map options, one video and one audio track is used, the video with the largest resolution, and the audio with the most tracks, and if there are more audio tracks, the one with the lowest index. Which should be in my case: audio 0, aka ENG.

But for some reason (unknown to me reason, that is), the resulting test 30 seconds file has only video and lacks any audio:
Code:
$ mpv P_V1_30s.mpg 
Playing: P_V1_30s.mpg
 (+) Video --vid=1 (mpeg2video 720x576 25.000fps)
VO: [opengl] 720x576 => 1024x576 yuv420p
V: 00:00:06 / 00:00:30 (20%) Cache: 10s+11MB
Why is there no audio when using -codec copy ? Using -codec copy and -acodec copy has the same result: no audio, the resulting mpg only has video.

What do I do wrong trying to use -map to include the 1st and 2nd audio track (aka audio0 and audio1) ?
ravs is offline   Reply With Quote
Old 3rd April 2018, 05:24   #2  |  Link
aidenn0
Registered User
 
Join Date: Jan 2018
Posts: 6
Your stream specifiers are way off. It's best to specify stream specifiers with the type, as otherwise you end up with something unexpected.

The easiest way to map all audio streams, for example is to include

Code:
-map 0:a
so e.g.
Code:
ffmpeg -i P_V0.VOB -map 0:v:0 -map 0:a -codec copy foo.mkv
aidenn0 is offline   Reply With Quote
Old 26th March 2020, 23:39   #3  |  Link
ravs
Registered User
 
Join Date: Nov 2010
Posts: 15
@all

(I know I reply to an old post, but it is my thread and I want to share the info with others who might lurk.)

What works in the above example would be e.g.
Code:
ffmpeg -i P_V0.VOB -map 0:v:0  -map 0:a:0 -map 0:a:1 -codec copy foo.mkv
would work.
Since I need a larger -probesize and -analyzeduration or else I would get an error I had to use this:
Code:
ffmpeg -v error -y -probesize 100000000 -analyzeduration 100000000 -i P_V0.VO -q:v 10 -map 0:v -map 0:a:0 -map 0:a:1 -vf yadif,scale=w=iw/1.2:h=ih/1.2 P_V0.mkv
I first did a test that encoded only 4 minutes to see if everything works okay like so:
Code:
ffmpeg -v error -y -probesize 100000000 -analyzeduration 100000000 -i P_V0.VO -q:v 10 -map 0:v -map 0:a:0 -map 0:a:1 -vf yadif,scale=w=iw/1.2:h=ih/1.2 -t 240 P_V0.mkv
Cave! The above also makes the video smaller and could result in an error when the factor /1.2 results in an uneven number for either the height or the width.
I used " -v error " to only include severe errors after I eliminated all basic mistakes first.
A test run of only a few minutes is usually recommended since the main decode takes a long time, and then realizing something went wrong would be annoying, since you had to repeat it all. But a test decode takes only a few minutes.
Still ffmpeg reported some errors:
Code:
[mpeg2video @ 0xf3ff40] ac-tex damaged at 43 0
[mpeg2video @ 0xf3ff40] Warning MVs not available
[mpeg2video @ 0xf3ff40] ac-tex damaged at 24 32
[mpeg2video @ 0xf3ff40] Warning MVs not available
[ac3 @ 0xdd8c80] expacc 125 is out-of-range
[ac3 @ 0xdd8c80] error decoding the audio block
Error while decoding stream #0:2: Error number -16976906 occurred
[ac3 @ 0xae7940] exponent -2 is out-of-range
[ac3 @ 0xae7940] error decoding the audio block
Error while decoding stream #0:3: Error number -16976906 occurred
[ac3 @ 0xaaad00] exponent -1 is out-of-range
[ac3 @ 0xaaad00] error decoding the audio block
Error while decoding stream #0:4: Error number -16976906 occurred
[ac3 @ 0xdd8c80] exponent 25 is out-of-range
[ac3 @ 0xdd8c80] error decoding the audio block
Error while decoding stream #0:2: Error number -16976906 occurred
[ac3 @ 0xae7940] exponent 26 is out-of-range
[ac3 @ 0xae7940] error decoding the audio block
Error while decoding stream #0:3: Error number -16976906 occurred
[ac3 @ 0xaaad00] incomplete frame
What do these errors mean exactly?
Is e.g.
Code:
[mpeg2video @ 0xf3ff40] ac-tex damaged at 43 0
referring to an error at 0:43.0?
Or at 0:00:43.0 meaning 43 seconds frame 0?
But the later cannot be, since when I did the test run of 240 seconds there was no error mentioned.

Or is @ 0xf3ff40 the reference to the position where the error occurred?
If so, how does 0xf3ff40 translate into the human readable form of HH:MM:SS.f (f stands for frame) ?

Last edited by ravs; 26th March 2020 at 23:44.
ravs is offline   Reply With Quote
Reply

Tags
ffmpeg dvd multi-language

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 13:45.


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