Results 1 to 10 of 711

Thread: HowTo: Encode Video for iPod Video

Threaded View

  1. #1
    Join Date
    Oct 2005
    Location
    Dallas
    Beans
    620
    Distro
    Ubuntu 7.04 Feisty Fawn

    HowTo: Encode Video for iPod Video

    ------Last Update------
    January 1, 2008: Started the New Year off with minor changes. Modified the installed packages for Gutsy and the FFMPEG SVN configure commands for the latest SVN.
    ------------------------

    After much searching and about a week of on and off again attempts, I finally got video to encode for my iPod Video. So, I thought I'd share with you how.

    This HowTo is broken up into three sections:
    Vive
    Transferring Video to the iPod Video
    Encoding Video to the iPod Video

    Vive

    Vive is the project that stemmed out of this HowTo. It is a GUI for ffmpeg, but has presets already loaded for the iPod (just for you!). Downloads can be found here.

    Currently, 2.0.0-beta1 is released, or you can use the SVN version. I always make sure that it runs before I commit to the SVN, so that would be the recommended way to go about it. Here's how to install it (you need to install ffmpeg first, so see below for it):

    Code:
    sudo apt-get install vobcopy mplayer libgtk2.0-dev libvte-dev libgnome2-dev libgnomeui-dev
    If you want DVD support, you need to do the following. If you do not want it, you must use the --disable-dvd flag for ./configure.
    Code:
    sudo apt-get install libdvdcss2-dev libdvdnav-dev libdvdread-dev
    Next, installation is rather simple (assuming you get the package either via the released package, or via the SVN.
    Code:
    ./configure --prefix=/usr
    make
    sudo make install
    Also, if you'd like the preloaded presets, please do the following:
    Code:
    mkdir ~/.vive
    cp examples/preferences ~/.vive
    Transferring Video to the iPod Video

    You will need to use gtkpod to transfer your files to your iPod. It's only one command:

    Code:
    sudo apt-get install gtkpod-aac
    This provides the ability to load video and audio that use the AAC sound codec, and it's also built with MPEG4 support. If anybody remembers the old instructions, this is MUCH easier.

    Congratulations, you can now transfer videos to your iPod Video

    Encoding Video for the iPod Video

    Dapper Packages!!!
    SBX has been kind enough to create .deb packages for ffmpeg and Vive for Dapper. You can get them here and install them both with sudo dpkg -i packagename.deb. Thanks so much to SBX for this contribution!

    In order to encode video for the iPod Video, you need to install ffmpeg from source because it does not come with the support needed for the iPod Video format for a litany of legal reasons concerning the distribution of Ubuntu. Luckily, this is still very legal, and you are not breaking any law in the United States or anywhere else by configuring and installing ffmpeg in this way. This section of the guide is broken into two subsections:

    1. Installing ffmpeg
    2. ipodvidenc Script

    The ipodvidenc Script is a simple bash script written by me to make encoding videos for the iPod Video quick and painless. Now, without further interruption, how to encode video for the iPod Video:

    Installing ffmpeg

    First, we need to fix ffmpeg for Ubuntu. We'll build it from source...but don't worry, it won't hurt. We'll also need to install some other libraries. So, here goes:

    Code:
    sudo apt-get install liblame-dev libxvidcore4-dev libx264-dev libfaac-dev libfaad2-dev liba52-dev libdc1394-dev libgsm1-dev libtheora-dev libvorbis-dev
    sudo apt-get build-dep ffmpeg
    There are 2 ways to do this. The version in the Ubuntu repositories does not have x264 support correct. You get an error in the ffmpeg code when you try to compile it. This can be averted by using the SVN version of ffmpeg. However, there are different flags to use, so the first one is using the ffmpeg in the repos (aka no x264), and the second is via the SVN (aka with x264).

    Without x264:
    Code:
    apt-get source ffmpeg
    cd ffmpeg-*/
    ./configure --enable-gpl --enable-pp --enable-vorbis \
    	--enable-libogg --enable-a52 --enable-dts \
    	--enable-dc1394 --enable-libgsm --disable-debug --enable-mp3lame \
    	--enable-faad --enable-faac --enable-xvid --enable-pthreads --enable-shared
    make
    sudo make install
    With x264:
    Code:
    sudo apt-get install subversion
    svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
    cd ffmpeg/
    ./configure --prefix=/usr --enable-gpl --enable-pp --enable-pthreads --enable-libdc1394 --enable-liba52 --enable-libfaac \
    --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libtheora --enable-libvorbis \
    --enable-libx264 --enable-libxvid --enable-shared --disable-debug
    make
    sudo make install
    You're done! You can now enjoy ffmpeg!

    ipodvidenc Script

    And last, but certainly not least, you can create a script for converting your videos to iPod Video format.

    Code:
    gedit
    This should pop up a blank document. Now, just copy and paste this code into it:

    Code:
    #!/bin/bash
    ## ipodvidenc - The iPod Video Encoder for Linux.
    ## Created by Eric Hewitt, January 9, 2006.
    ## Released under the GPL.  Go nuts.
    
    input_file=$1
    
    echo "What would you like to name the output file (sans extension)?"
    
    read output_file_name
    
    echo "$output_file_name will be located in $PWD. Is this acceptable? [y/n]"
    
    read output_file_loc_permis
    
    if [ $output_file_loc_permis = 'n' ] || [ $output_file_loc_permis = 'N' ]
    then
    	echo "Where would you like to store $output_file_name.mov?"
    	read output_dir
    else
    	output_dir=$PWD
    fi
    
    ffmpeg -i "${input_file}" -f mp4 -vcodec mpeg4 -maxrate 1000k -b 700k -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -ab 192 -s 320x240 -aspect 4:3 "${output_dir}/${output_file_name}.mov"
    Save as ipodvidenc in your present working directory (it will be moved, anyway). Back in the terminal, run:

    Code:
    chmod 755 ipodvidenc
    sudo mv ipodvidenc /usr/bin
    Now, when you want to encode a video to iPod format, run this command:

    Code:
    ipodvidenc video.avi
    It will run you through a few prompts and then encode the video. You can now use gtkpod to upload the video onto your iPod just like you load mp3's onto it.

    *Note: You can now use ipodvidenc to encode straight from a *.vob file. This way, you can rip your DVDs using dvd::rip, and then simply encode them by passing them through ipodvidenc. Make sure that you compile ffmpeg with a52 support in order to do this, though.

    This is a very basic script if you do not want the much larger and GUI version of ipodvidenc which can be found attached.

    Fixing Video for the 60GB iPod v1.1 Firmware

    In the new firmware for the 60GB iPods, video will play for 15 seconds, stop, and then continue without audio. If this happens to you, you need to install gpac, like this:

    Code:
    sudo apt-get install gpac
    You can then remux the video so that it will work on your iPod using the following command:

    Code:
    MP4Box -add videofile.mov videofile.mov
    A note: You can use the same name for the input and the output...it will simply overwrite the existing file.

    Happy encoding!

    Credits:
    Original Sources:


    Much thanks to:
    • Iandefor for countless suggestions, bugfixes, and corrections.
    • Dromio for corrections.
    • quietglow for corrections and the .deb support for mpeg4ip
    • pestilence4hr for corrections regarding the building of ffmpeg
    • hal pacino for the info about MP4Box
    • SBX for the Dapper packages.
    • Sir_Yaro for information about the mpeg4ip error correction.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	main_window.png 
Views:	912 
Size:	46.4 KB 
ID:	38702   Click image for larger version. 

Name:	main_window_terminal.png 
Views:	550 
Size:	29.3 KB 
ID:	38703   Click image for larger version. 

Name:	preferences_window.png 
Views:	671 
Size:	37.2 KB 
ID:	38704  
    Attached Files Attached Files
    Last edited by endersshadow; January 1st, 2008 at 09:23 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •