I'm late to the party, but this is how I did my last attempt at ripping DVD's once I rescued and updated my notes on that.
This would take a 3 min. sample output of the original source compressed with h.265 video codec while subtitles and audio are passed through (copied without being transcoded).
Code: Select all
vobcopy -Mlo - | ffmpeg -analyzeduration 100M -probesize 100M \
-i - -map 0 -map -0:0 -c:s copy -c:a copy \
-c:v libx265 -crf 23 -preset veryfast \
-vf yadif=1,hqdn3d,"$cropvalue":keep_aspect=1 \
-t 180 -threads 0 -y 3min-test.mkv
Crop value was obtained by:
Code: Select all
cropvalue=`vobcopy -Mlo - | ffmpeg -i - -ss 600 -t 1 -vf cropdetect -f null - 2>&1 | awk '/crop/ { print $NF }' | tail -1`
(takes some seconds to complete because it jumps 600 seconds and then applies the crop detection filter).
Some explanation follows:
analyzeduration 100M and
probesize 100M, allows ffmpeg to detect available subtitle streams. Should ffmpeg not detect any subtitle stream, try to increase the value to something like 200M each.
-map 0 and -map -0:0 instructs ffmpeg to parse all streams (map 0),
but the first one (map -0:0), so the
dvdmenu is avoided.
The next 2 lines, are the ones involved in video processing where some video filters (vf) are added, including
deinterlace (yadif), hi-quality
denoise (hqdn3d),
cropping and
scaling (the ones I commonly use). When scaling 720:-1 you tell ffmpeg to size the output to 720 px width and calculate the height according to the display aspect ratio (although I need to check later versions of ffmpeg).
Finally
-t 180 tells ffmpeg to process only 180 seconds of video and
threads 0 pulls from all available cores to the task.
Of course you should change the above values to the ones suiting your needs, but h265 codec delivers for more compression than h264 one.
Be aware that maybe not all your devices are compatible with h265 codec.
Hope it helps.
(Edited the -map section)
Cheers!