Encode video for ipod classic

I just finished installing ffmpegon debian wheezy using these instructions - http://trac.ffmpeg.org/wiki/UbuntuCompilationGuide . Now I want to encode the video for playback on iPod classic . The video has the following information:

$ 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 already tried just copying the video to iPod using banshee, but the video just shows a black screen. What is the best format for playing video on iPod? What ffmpeg options should I use? I would like to maximize resolution with a minimum file size.

+4
source share
1 answer

, , , iPod Classic 640x480 specs, , - 1280x720. H.264, , 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
  • -crf -preset. . FFmpeg x264 Encoding Guide.

  • -level -refs , . , .

  • scale video filter 640x360. -1 16: 9 , 640 .

  • pad , , . 16: 9 4: 3, iPod classic. , iPod , , . , , :

    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
    
  • format , . ffmpeg libx264, , FFmpeg, , yuv420p, . , -pix_fmt yuv420p, , format , ( ).

  • , , , ( ) .

+6

Source: https://habr.com/ru/post/1537823/


All Articles