How to Create iPad Formatted Videos Using HandBrake or FFMpeg

This is for those who may want to load a video onto their iPad with iTunes that isn’t in the correct format. I needed to do this because I was trying to put an iTunes University video on my iPad a couple days ago and iTunes complained that it wasn’t in the correct format for the iPad. I’m not sure exactly how that could be but I decided to take the opportunity to see if I could use HandBrake to easily convert it to an iPad friendly format. There is currently no pre-loaded iPad configuration for HandBrake like there is for the iPhone and iPod Touch so I created a few profiles that can easily be imported into HandBrake to output different sizes for the iPad:

Note that when you import videos using iTunes the iPad puts them in their own Videos app unlike the iPhone where they show up under the iPod app. You will want to find the Videos icon if you don’t already know where it is:

iPad Videos Screenshot

After verifying that the above 4×3 version worked for the iTunes University video, I went about testing it on a couple of other video formats. I tested the Big Buck Bunny video that I also used for my post on iPad video streaming in both 640×360 and 1024×576 output formats. Both resolutions looked great. In between these tests, I took a short break to play ?? ??, which provided a nice distraction. I also tried converting a DVD. If you decide to convert a DVD, you will probably want to turn on de-interlacing in HandBrake. You do that by first selecting the “Picture Settings” option:

HandBrake Picture Settings Screenshot

Then the filters tab and then select the type of de-interlace you want (fast, slow, slowest):

HandBrake DeInterlace Settings Screenshot

If you want to use FFMpeg to do all this you can. The following is a slightly modified version of the streaming command I’m using that will output a high bitrate version of the input video:

[code lang=”bash”]
ffmpeg -y -i input.avi -acodec aac -ar 48000 -ab 128k -ac 2 -s 1024×768 -vcodec libx264 -b 1200k -flags +loop+mv4 -cmp 256 -partitions +parti4x4+partp8x8+partb8x8 -subq 7 -trellis 1 -refs 5 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 1200k -maxrate 1200k -bufsize 1200k -rc_eq ‘blurCplx^(1-qComp)’ -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 16:9 -r 30 -g 90 -async 2 output.mp4
[/code]

23 thoughts on “How to Create iPad Formatted Videos Using HandBrake or FFMpeg

  1. carson Post author

    @Sean on the main screen you should have an import button at the bottom right hand corner. It will be under your current set of profiles next to a trash button.

  2. Ryan

    Carson – I’m trying to put some of my DVDs I own onto my iPad 3G that will arrive this coming week. I downloaded your presets. I’m hoping to get the videos full screen on the ipad. Will the “ipad-full.plist” do just that? When I clicked into picture settings it showed the width at 640 and the height at 480. I thought the res on the ipad was like 1024 or something. I’m new at this whole ripping/converting stuff so try to bear with me. Thanks a bunch!

  3. Mark

    I’m getting an error on the –partion portion of the FFMPEG command line. I suspect I have an older FFMPEG. Can you direct me to an already compiled Windows executable? I run Windows 7.

    Thank you.

  4. advil

    just stopping by to tell you i love you for this. i’m using this to convert things from HD blu ray rips like Watchmen to old classics like Casablanca. it would have been a pain in the ass to do this manually for each one.

    when do you recommend using the 16:9 vs the “full” presets? i only used full on the HD blu ray rips and just 16:9 for regular widescreen films. is that right?

  5. carson Post author

    I’m not familiar with the windows version of FFMpeg so I don’t know where to get an up to date binary. If you find one drop back by and let others know.

  6. carson Post author

    The full profile will get you the full resolution. Full screen will be different depending on the format of your movie. You probably want to load up one of the presets and then tinker with the size to get it right.

  7. Larry Gilman

    I try downloading iPad-Full.plist using “save as”; it appears on my desktop as iPad-Full.plist.xml. When I import it into HandBrake it appears in the preset list but not in blue text like the built-ins, but in black. If I select it, nothing happens. Picture Settings does now show any change. It seems to be inactive. Deleting the .xml extension – no difference.

    Advice?

    Many thanks —

    Larry

  8. Jed Teres

    I set Handbrake to de-interlace, but now when I try to use one of your settings, it crashes. Prior to that, i wasn’t seeing much of a difference in settings when switching between the three of them; perhaps I wasn’t looking in the right place? That said, things seemed to turn out OK without de-interlacing.

  9. Kenny Mann

    Thank you.

    Throughput with iPad-Full.plist works on every video format I’ve tried, regardless of original picture size or aspect ratio. Results just fit the full screen with the best image available from the data in the original file. iPad-ready in two clicks.

    BTW: People running non-current versions of Handbrake won’t be happy trying to import the presets. Easiest access requires version 0.9.4.

  10. Frank Leers

    The ffmpeg options seem to be off.

    ffmpeg -fpre ipadfull.ffpreset -s 1024X768 -r 30 -async 2 -aspect 16:9 -i foo.mpg foo2.mpg
    Where my preset file (ipadfull.ffpreset) contains:
    acodec=aac
    ar=48000
    ab=128k
    ac=2
    vcodec=libx264
    #vcodec=ipod
    #vcodec=h264
    b=1200k
    flags=+loop+mv4
    cmp=256
    partitions=+parti4x4+partp8x8+partb8x8
    subq=7
    trellis=1
    refs=5
    coder=0
    me_range=16
    keyint_min=25
    sc_threshold=40
    i_qfactor=0.71
    bt=1200k
    maxrate=1200k
    bufsize=1200k
    rc_eq=’blurCplx^(1-qComp)’
    qcomp=0.6
    qmin=10
    qmax=51
    qdiff=4
    level=30
    #aspect=16:9
    #r=30
    g=90

    gives:

    FFmpeg version git-08a083b, Copyright (c) 2000-2010 the FFmpeg developers
    built on May 12 2010 12:23:51 with gcc 4.4.1
    configuration: –prefix=/usr/local –enable-avfilter –enable-avfilter-lavf –enable-vdpau –enable-bzlib –enable-libgsm –enable-libschroedinger –enable-libspeex –enable-libtheora –enable-libvorbis –enable-pthreads –enable-zlib –disable-stripping –enable-gpl –enable-postproc –enable-swscale –enable-x11grab –enable-libdc1394 –enable-shared –disable-static –enable-libfaac –enable-nonfree –enable-libx264
    libavutil 50.15. 2 / 50.15. 2
    libavcodec 52.67. 0 / 52.67. 0
    libavformat 52.62. 0 / 52.62. 0
    libavdevice 52. 2. 0 / 52. 2. 0
    libavfilter 1.20. 0 / 1.20. 0
    libswscale 0.10. 0 / 0.10. 0
    libpostproc 51. 2. 0 / 51. 2. 0
    Unknown decoder ‘libx264’

  11. Fred

    the iPadFull.plist download above is designated “4×3 aspect ratio at 1024×576”.

    But 1024×576 is 16:9, not 4:3, isn’t it?

    Or is my math wrong somehow? Wouldn’t be the first time…

    In any case, thanks for posting the profiles. I imported them to Handbrake and they work seamlessly. I’m very impressed, and you’ve simplified my life enormously. For this, much thanks!

  12. Simon

    Fred, It’s funny – I sat here for a minute trying to figure that out… You’re right. Simple math eludes me now and then! 4×3 would be 1024 x 768. Despite the math bits, these are great for starters.

    Carson, your post is much appreciated. Thanks for putting up your plists, saved me some work!

    Cheers,

    Simon

  13. Darren

    Hi,

    Thanks for the presets, I was just wondering though, if you notice that the resulting video looks darker than the source material?

    Regards,

    Darren

  14. Trenton D. Adams

    The quality of the ffmpeg command given produces very poor quality video for an iPad. I put “-maxrate 10000k” and remove the -qmin and -qmax, and add “-g 250”

    p.s.
    Frank, I had the same problem as you, when using a preset file. Namely “Unknown decoder ‘libx264′”. I need to move the parameter for your preset file to after the input video file. libx264 is an encoder, not a decoder, so it must come after the input file.

  15. Trenton D. Adams

    Oh, by the way, here’s my preset file…

    # /home/myuser/.ffmpeg/iPad.ffpreset
    threads=4
    acodec=aac
    ar=48000
    ab=128k
    ac=2
    vcodec=libx264
    b=1200k
    flags=+loop+mv4
    cmp=+chroma
    partitions=+parti4x4+partp8x8+partb8x8
    subq=7
    trellis=1
    refs=5
    coder=0
    me_range=16
    keyint_min=25
    bt=256k
    maxrate=10000k
    sc_threshold=40
    i_qfactor=0.71
    qdiff=4
    level=30
    g=250

    And I run…
    ffmpeg -s 1024×768 -r 30 -async 2 -aspect 16:9 -y -i input.avi -spre iPad output-iPad.mp4

  16. saintdev

    For your ffmpeg command line, you should really change it from “-acodec aac” to “-acodec libfaac”. The ffmpeg aac encoder is currently a bit broken, and will result in very poor audio quality. It’s being worked on, but it will be a while before it is usable. FAAC does have license issues, but at least it’s not broken.

  17. Rich

    OK sorry to be so dumb
    I copied these presets to my desk top
    then added a preset by using the add button at the bottom right.
    i then chose a .wmv file on my computer
    when I try and convert it, the wondow cmd.exe is launched and it reports something like 11 hours for a 30 minute video file.
    I am lost. what am i doing wrong?
    thanks

  18. charmie

    Why is it the result is not fullscreen? i download your ipad-full.plist but the result isnt full resolution on ipad?

  19. michelle

    i have vista with a 64bit OS – i used the ipad preset for full list. i got as far as getting two different movies into itunes, but they don’t play correctly. the picture is distorted into boxes as if its damaged. can anyone tell me what i did wrong?

  20. Rich

    Would these be the same FFMPG settings to do HTTP Live Streaming as demonstrated in your article for the iPhone. That is this would be the high settings for the iPad. I’m having trouble getting my app accepted due to these playlist variants (video and audio only). Looking for a easier way to convert a bunch of videos at once to meet these requirements.

Comments are closed.