Video 为ipod classic编码视频
我刚刚使用这些说明在debian wheezy上安装完Video 为ipod classic编码视频,video,ffmpeg,ipod,Video,Ffmpeg,Ipod,我刚刚使用这些说明在debian wheezy上安装完ffmpeg。现在我想编码一段视频在我的电脑上播放。该视频包含以下信息: $ mediainfo in.mp4 General Complete name : in.mp4 Format : MPEG-4 Format profile : Base Media / Ve
ffmpeg
。现在我想编码一段视频在我的电脑上播放。该视频包含以下信息:
$ 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
我已经尝试过用banshee将视频复制到IPod上,但是视频只是显示了一个黑屏。在Ipod上播放视频的最佳格式是什么?我应该使用什么ffmpeg参数?我希望在最小化文件大小的同时最大化分辨率。您可能需要重新编码,因为根据您提供的分辨率,iPod Classic可以处理高达640x480的视频,但您的视频是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
当前未为此编码器设置-level
,因此手动设置。有一个挂起的补丁来解决这个问题,所以它应该很快得到修复-refs
- 在这种情况下,将输出缩放到640x360。
值保持高度标注中原始的16:9纵横比,而-1
值设置新的宽度640
- 指定视频的新最大宽度和高度,加上侧面填充和顶部填充(以像素为单位)。这对于将16:9的原始视频信箱成iPod classic要求的4:3纵横比是必要的。如果不这样做,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
- 将确保输出使用兼容的色度子采样方案
在使用libx264时,默认情况下会尝试避免或最小化色度子采样,但基于非ffmpeg的播放器和设备不支持yuv420p以外的任何内容,因此包括这一点将确保兼容性。这与您在其他示例中看到的使用ffmpeg
相同,但使用-pix_fmt yuv420p
允许您具体说明它将应用于其他过滤器的位置(在这种情况下,这并不太重要)格式
- 由于音频可能很好,因此可以(重新混音)而不是重新编码