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
Control quality with
-crf
and encoding speed with-preset
. See the FFmpeg and x264 Encoding Guide for more info on those options.-level
currently does not set-refs
for this encoder, so set it manually. There is a pending patch to resolve this so it should be fixed soon.The
scale
video filter will scale the output to 640x360 in this case. The-1
value maintains the original 16:9 aspect ratio in the height dimension, while the640
value sets the new width.The
pad
video filter specifies the new maximum width and height of the video, plus the side-padding and top-padding in pixels. This is necessary to letterbox the original 16:9 video into the 4:3 aspect ratio required by the iPod classic. If this is not done then the iPod will expand the video to fit the screen height and will crop off the sides of the video during playback. To calculate the necessary values for for this parameter, consider that:1280*x = 640 # x is the resize factor in the width dimension x = 640/1280 = 0.5 # now we know x 720*x + 2*p = 480 # scaling the original video height by x, then adding # equal padding p above and below the video must give the new desired # video height of 480. solve for p 360 + 2*p = 480 p = 60
The
format
video filter will ensure that the output uses a compatible chroma subsampling scheme.ffmpeg
attempts to avoid or minimize chroma subsampling by default when using libx264, but non-FFmpeg based players and devices do not support anything other than yuv420p, so including this will ensure compatibility. This is the same as using-pix_fmt yuv420p
that you may see in other examples, but usingformat
allows you to be specific as to where it will be applied in relation to other filters (not that it really matters too much in this case).Since the audio is probably fine as is it can be stream copied (re-muxed) instead of re-encoded.