VideoHelp Forum




+ Reply to Thread
Results 1 to 9 of 9
  1. This is my process for ripping DVD's to mkv file. My primary goal is to have files that my TV can play with just a thumb drive, which means I have made a few compromises for compatibility. My secondary goal is very high quality.

    Please let me know if there are any parameters that could be tweaked, added, or removed from this process for a better end result. This process is for live action movies, and I have a few unmentioned changes for cartoons. Thanks in advance.


    #Use MakeMKV to rip DVD into a .mkv video video file.
    #
    #Note: the 2-pass video enocing portions require you to enter the video screen resolution below. Try to keep these number to be multiples of 16 (i.e. evenly divisible by 16) for optimal image quality.


    ffmpeg -i '{input.mkv}' -async 1 -acodec copy -scodec copy -f mp4 -r 29.97 -vcodec libx264 -crf 0 -threads 0 -preset ultrafast -flags global_header -y '/media/justin/2TB/Movies/Temp/large.mp4' &&\
    \
    ffmpeg -i '/media/justin/2TB/Movies/Temp/large.mp4' -async 1 -acodec copy -scodec copy -vcodec libx264 -crf 0 -preset ultrafast -vf fieldmatch,yadif=deint=interlaced,mpdecimate=max=-4:hi=1000:frac=1 -r 23.976 '/media/justin/2TB/Movies/Temp/large IVTC.mp4' &&\
    \
    ffmpeg -i '/media/justin/2TB/Movies/Temp/large IVTC.mp4' -map 0:1 -async 1 -acodec copy -threads 0 -y '/media/justin/2TB/Movies/Temp/sound.ac3' &&\
    \
    ffmpeg -i '/media/justin/2TB/Movies/Temp/sound.ac3' -acodec flac -y '/media/justin/2TB/Movies/Temp/sound.flac' &&\
    \
    ffmpeg -i '/media/justin/2TB/Movies/Temp/sound.flac' -ac 2 -y '/media/justin/2TB/Movies/Temp/stereo sound.flac' &&\
    \
    ffmpeg -i '/media/justin/2TB/Movies/Temp/stereo sound.flac' -af 'volume=3' -y '/media/justin/2TB/Movies/Temp/3x louder stereo sound.flac' &&\
    \
    ffmpeg -i '/media/justin/2TB/Movies/Temp/3x louder stereo sound.flac' -acodec libmp3lame -b:a 320k -y '/media/justin/2TB/Movies/Temp/3x louder stereo sound.mp3' &&\
    \
    ffmpeg -i '/media/justin/2TB/Movies/Temp/large IVTC.mp4' -pix_fmt yuv420p -f null -r 23.976 -y -g 120 -sc_threshold 40 -bf 3 -b_strategy 2 -b:v 2000k -coder 1 -refs 6 -flags +loop -qmin 10 -qmax 51 -qdiff 4 -i_qfactor 0.71 -me_method dia -me_range 12 -subq 2 -trellis 1 -threads 0 -filter:v scale={size} -vcodec libx264 -partitions +partp8x8+partb8x8+parti8x8 -b-pyramid strict -weightb 1 -mixed-refs 1 -8x8dct 1 -threads 0 -fast-pskip 1 -fastfirstpass 0 -direct-pred auto -tune film -passlogfile '/home/justin/Videos/temp/1.log' -pass 1 -y /dev/null &&\
    \
    ffmpeg -i '/media/justin/2TB/Movies/Temp/large IVTC.mp4' -pix_fmt yuv420p -r 23.976 -y -g 120 -sc_threshold 40 -bf 3 -b_strategy 2 -b:v 2000k -coder 1 -refs 6 -flags +loop -qmin 10 -qmax 51 -qdiff 4 -i_qfactor 0.71 -me_method umh -me_range 24 -subq 8 -trellis 2 -threads 0 -filter:v scale={size} -vcodec libx264 -partitions +parti4x4+partp8x8+partb8x8+parti8x8 -b-pyramid strict -weightb 1 -mixed-refs 1 -8x8dct 1 -threads 0 -direct-pred auto -tune film -passlogfile '/home/justin/Videos/temp/1.log' -pass 2 -y '/media/justin/2TB/Movies/Temp/2Pass.mp4' &&\
    \
    ffmpeg -i '/media/justin/2TB/Movies/Temp/2Pass.mp4' -i '/media/justin/2TB/Movies/Temp/3x louder stereo sound‎.mp3' -c copy -map 0:v:0 -map 1:a:0 -shortest '/media/justin/2TB/Movies/{output.mkv}'
    Quote Quote  
  2. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Since you never stated WHICH TV you have, we have no idea what file-playing capabilities it has going for it. All decisions about quality AND compatibility ought to be based on that foreknowledge (example: on some TVs you may not even need to convert at all so why waste time & quality converting)...

    Scott
    Quote Quote  
  3. First error are incorrect framerates...
    Quote Quote  
  4. Scott - The tv is a Panasonic TC-S30. It c an play mp4 & mkv containers with h264, aac, and mp3 codecs. Some compromises I can remember are: 1) had to use "-async 1" option to keep sound in sinc with video (my other tv did not require this); 2) I had to use stereo sound because the tv cannot handle 5.1 surround sound; 3) the "-flags global_header" option was removed from the two-pass encoding lines because it prevented my tv from being able to seek through the video (again, my other tv did not have this issue); 4) There are others I don't remember right off hand. My main point was that not everything about my code is designed soley for audio/video encoding concerns.
    Last edited by Justin832; 15th Nov 2015 at 21:20.
    Quote Quote  
  5. Pandy - which frame rates are incorrect and what should they be?
    Quote Quote  
  6. Originally Posted by Justin832 View Post
    Pandy - which frame rates are incorrect and what should they be?
    29.97 is in real life 30000/1001 = 29.97002997002997...
    23.976 is in real life 24000/1001 = 23.97602397602398...

    This small difference will lead in sufficiently long movie to desyncing errors between audio and a video, additionally it will force ffmpeg to remove/add frames not present in original video.You need to express correctly those frame rates.

    At second i don't understand why you going for two pass in a such bizarre way... use correct preset and force BD compliance with HP@L4.0 (i would not recommend 4.1 as some HW decoders can't deal properly with bitrates over 30 - 40Mbps).
    Quote Quote  
  7. Originally Posted by pandy View Post
    Originally Posted by Justin832 View Post
    Pandy - which frame rates are incorrect and what should they be?
    29.97 is in real life 30000/1001 = 29.97002997002997...
    23.976 is in real life 24000/1001 = 23.97602397602398...
    I replaced 29.92 with 30000/1001 and 23.976 with 24000/1001 and it worked, so thanks! I vaguely remember reading something about ffmpeg equating the two, but the fraction is certainly error proofing that.
    Quote Quote  
  8. Originally Posted by pandy View Post
    At second i don't understand why you going for two pass in a such bizarre way... use correct preset and force BD compliance with HP@L4.0 (i would not recommend 4.1 as some HW decoders can't deal properly with bitrates over 30 - 40Mbps).
    I like my second pass settings better than any particular preset, plus I have a few more settings that are not part of the defaults.

    What is "BD compliance"?

    what is "HP@L4.0"? What is "HP____"?

    HW = hardware?

    I am keeping my DVD encoded files to about 2 Gb via 2 Mbps bitrates. When I get to bluray, I'm thinking I'll use something like 4 - 6 Mbps. When would I ever be concerned with bitrates around 35 Mbps, other than for lossless encoding?
    Quote Quote  
  9. Originally Posted by Justin832 View Post
    I like my second pass settings better than any particular preset, plus I have a few more settings that are not part of the defaults.
    Fine for me - wise people says - Not my circus and not my monkeys.

    Originally Posted by Justin832 View Post
    What is "BD compliance"?

    what is "HP@L4.0"? What is "HP____"?

    HW = hardware?
    High Profile Level 4.0, yes, HW is a hardware - for compatibility it is good to stay within BD restrictions and avoid non-standard (own) configuration.

    Originally Posted by Justin832 View Post
    I am keeping my DVD encoded files to about 2 Gb via 2 Mbps bitrates. When I get to bluray, I'm thinking I'll use something like 4 - 6 Mbps. When would I ever be concerned with bitrates around 35 Mbps, other than for lossless encoding?
    Well it depend from content - noisy, difficult, complex, lot of motion source will produce higher bitrate.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!