videoffmpegipod

Encode video for ipod classic


I just finished installing ffmpeg on debian wheezy using these instructions - http://trac.ffmpeg.org/wiki/UbuntuCompilationGuide. Now I want to encode a video to play on my iPod classic. The video has the following info:

$ mediainfo in.mp4 
General
Complete name                            : in.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42
File size                                : 1.21 GiB
Duration                                 : 55mn 10s
Overall bit rate mode                    : Variable
Overall bit rate                         : 3 130 Kbps
Encoded date                             : UTC 2010-08-25 23:38:59
Tagged date                              : UTC 2010-08-25 23:38:59

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.2
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 2 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 55mn 10s
Bit rate mode                            : Variable
Bit rate                                 : 3 000 Kbps
Maximum bit rate                         : 5 000 Kbps
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 fps
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.109
Stream size                              : 1.16 GiB (96%)
Language                                 : English
Encoded date                             : UTC 2010-07-21 13:28:49
Tagged date                              : UTC 2010-07-21 13:28:49
Color primaries                          : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics                 : BT.709-5, BT.1361
Matrix coefficients                      : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 55mn 10s
Bit rate mode                            : Variable
Bit rate                                 : 125 Kbps
Maximum bit rate                         : 270 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 KHz
Compression mode                         : Lossy
Stream size                              : 49.4 MiB (4%)
Language                                 : English
Encoded date                             : UTC 2010-07-21 13:28:49
Tagged date                              : UTC 2010-07-21 13:28:49
mdhd_Duration                            : 3310353

I have already tried just copying the video to the IPod with banshee but the video just shows a black screen. Which is the best format to play the video on the Ipod? What ffmpeg parameters should I use? I would like to maximize resolution while minimizing file size.


Solution

  • You will probably have to re-encode because the iPod Classic can handle up to 640x480 according to the specs you provided, but your video is 1280x720. Video can be H.264, Baseline Profile, Level 3.0:

    ffmpeg -i in.mp4 -vcodec libx264 -crf 23 -preset fast -profile:v baseline \
    -level 3 -refs 6 -vf "scale=640:-1,pad=iw:480:0:(oh-ih)/2,format=yuv420p" \
    -acodec copy output.mp4