I was asked to upload 2 DVD's to youtube so that all my relatives can watch it. Initially I uploaded the .vob files which is more then 15 minutes duration, but youtube did not allow me to upload any videos which has more then 15 mins duration. This problem led to figure out the ways of converting the .vob files to mp4 and then splitting the videos which will not exceed 15 mins of video duration.
A quick googling helped me with lot of links so I am aggregating all those links to help those people who hate GUI and love linux terminal more then any then else like me.
First you need to set up the ffmpeg and lot of other packages on ubuntu. Make sure you have installed the git client on you ubuntu laptop or desktop what ever you are running.
Preparation
Remove any existing packages:
sudo apt-get remove ffmpeg x264 libav-tools libvpx-dev libx264-dev yasm
Get the dependencies (Ubuntu Desktop users):
sudo apt-get update sudo apt-get -y install autoconf build-essential checkinstall git libass-dev libfaac-dev \ libgpac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev \ librtmp-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev \ libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev Installation Yasm Yasm is an assembler and is recommended for x264 and FFmpeg. cd wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz tar xzvf yasm-1.2.0.tar.gz cd yasm-1.2.0 ./configure make sudo checkinstall --pkgname=yasm --pkgversion="1.2.0" --backup=no \ --deldoc=yes --fstrans=no --default
x264
H.264 video encoder. The following commands will get the current source files, compile, and install x264. See the x264 Encoding Guide for some usage examples.
cd git clone --depth 1 git://git.videolan.org/x264 cd x264 ./configure --enable-static make sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \ awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \ --fstrans=no --default
fdk-aac
AAC audio encoder.
cd git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git cd fdk-aac autoreconf -fiv ./configure --disable-shared make sudo checkinstall --pkgname=fdk-aac --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \ --deldoc=yes --fstrans=no --default
libvpx
VP8 video encoder and decoder.
cd git clone --depth 1 http://git.chromium.org/webm/libvpx.git cd libvpx ./configure --disable-examples --disable-unit-tests make sudo checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no \ --deldoc=yes --fstrans=no --default
FFmpeg
cd git clone --depth 1 git://source.ffmpeg.org/ffmpeg cd ffmpeg ./configure --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame \ --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora \ --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 make sudo checkinstall --pkgname=ffmpeg --pkgversion="7:$(date +%Y%m%d%H%M)-git" --backup=no \ --deldoc=yes --fstrans=no --default hash -r
You can add more packages and update the existing packages. Click here to know more
I flooded with several commands to convert a DVD to mp4 I am sharing it here.
ffmpeg -i concat:"/media/dvd/VIDEO_TS/VTS_01_1.VOB|/media/dvd/VIDEO_TS/VTS_01_2.VOB" \ -acodec libfaac -aq 100 -ac 2 -vcodec libx264 -vpre slow -crf 24 -threads 0 output.mp4
for f in *.VOB; do ffmpeg -i "$f" -acodec libfaac -ac 2 -ab 128k -vcodec libx264 -preset fast -crf 21 -threads 0 moviename.mp4; done Here is a command to split the mp4 videos ffmpeg -acodec copy -vcodec copy -ss START -t LENGTH -i ORIGINALFILE.mp4 OUTFILE.mp4 where START is starting positing in seconds or in format hh:mm:ss LENGTH is the chunk length in seconds or in format hh:mm:ss
So you will need to run this command few times depending on how long your video.
If let's say your video is 31 minutes long and you want so split into 15 min chunks here is how you run it:
ffmpeg -acodec copy -vcodec copy -ss 0 -t 00:15:00 -i ORIGINALFILE.mp4 OUTFILE-1.mp4
ffmpeg -acodec copy -vcodec copy -ss 00:15:00 -t 00:15:00 -i ORIGINALFILE.mp4 OUTFILE-2.mp4
ffmpeg -acodec copy -vcodec copy -ss 00:30:00 -t 00:15:00 -i ORIGINALFILE.mp4 OUTFILE-3.mp4
There is a python script that you can use that does this automatically(i.e. takes video file, chunk size in seconds and generates individual playable video files): http://icephoenix.us/notes-for-myself/auto-splitting-video-file-in-equal-chunks-with-ffmpeg-and-python/
You are ready to go, let me know if you any problems.