Linux Archive

Linux Archive (
-   Debian User (
-   -   Can DVD isos be converted to use h264? (

Philip Ashmore 10-10-2012 09:26 AM

Can DVD isos be converted to use h264?
Hi there.

I'm one of those people who think that the DVD menu is part of the movie
experience - otherwise I'd just convert the VOB files and be done with it.

Yeah, I know - the DVD standard mandates mpeg-1 or mpeg-2, but in a
recent test, xbmc 3:11.0-0.1 appeared to want to at least try to decode
the DVD iso I converted:

You'll need to install xbmc-skin-confluence - xmbc will bail without it.

Here's a snippet from ~/.xbmc/temp/xbmc.log

CDVDVideoCodecFFmpeg::Open() Using codec: H.264 / AVC / MPEG-4 AVC /
MPEG-4 part 10

So it looks promising.

I'm either encoding those VOB files incorrectly and/or not generating
the ISO correctly.

I've attached a script that uses fuseiso9660 to user-mount a dvd iso
onto a directory, converts the VOB files to h264 and runs genisoimage to
create a new iso.

The new iso is 1,861,853,184 bytes long compared to 7,249,934,336 bytes
- quite some space saving if I'm doing it right.

I've attached a script based on what information I could find - but is
this approach correct?

Any comments/suggestions welcome.

Philip Ashmore
# Work files are created in the current directory as temp files will
# most likely be too large for /tmp.
# Make sure you have enough free disk space for about 3x-4x the dvd size.
set -e

rm -fr $wrkdir
rm -fr $isodir
return $1
if test "$1" = "" || test ! -f $1 ; then
echo "Usage: dvd2h264 <file.iso> [stage]"
exit 1

if "`ffmpeg -formats | grep "raw H.264 video format" | wc -l`" != "1" ; then
echo "ffmpeg doesn't support h264!"
exit 1


if test "$2" = "" ; then
if test ! -d $wrkdir; then mkdir $wrkdir; else rm -fr $wrkdir/*; fi
if test ! -d $isodir; then mkdir $isodir; else rm -fr $isodir/*; fi
fuseiso9660 $1 $isodir

# Has the DVD been converted already?
avob="`ls $isodir/VIDEO_TS/*.VOB* | head -n 1 2>/dev/null`"
if test "$avob" = "" ; then
echo "No VOB files found in VIDEO_TS/ - not a video DVD."
fusermount -u $isodir
return cleanup 1
codec="`ffprobe -show_streams VTS_01_0.VOB 2>/dev/null | head -n 10 | grep codec_name`"
if test "codec" != "codec_name=mpeg2video" ; then
echo "DVD already converted."
fusermount -u $isodir
return cleanup 0

# Copy the contents into workdir
cp -r $isodir/* $wrkdir/

fusermount -u $isodir

# Get rid of ;1 that fuse sometimes adds (?)
cd $wrkdir/VIDEO_TS
chmod +w .
for a in `ls *` ; do
if test "$a" != "$b"; then
echo "$a -> $b"
chmod +w $a
mv $a $b
chmod -w $b

# Use ffmpeg to transform those VOB files.
for a in `ls *.VOB` ; do
if test -f $a.h264 ; then continue; fi
# Taken from "man ffmpeg".
ffmpeg -i $a -map 0 -c:v libx264 -c:a copy -c:s copy $a.h264
echo "ffmpeg done. Replacing VOBs."
for a in `ls *.VOB` ; do
mv -f $a.h264 $a
cd ../..
# All done; convert the temp dir back into a DVD.
echo "Writing DVD image result-$1."
genisoimage -o result-$1 $wrkdir
chmod --reference=$1 result-$1
# Compare them, try the new one out, etc.
# mv -f result-$1 $1

All times are GMT. The time now is 09:29 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.