我有三星 Galaxy S4 相机拍摄的全高清视频。
视频流信息如下:
{"index":0,"codec_name":"h264","codec_long_name":"H.264 \/ AVC \/ MPEG-4 AVC \/ MPEG-4 part 10","profile":"High","codec_type":"video","codec_time_base":"1\/180000","codec_tag_string":"avc1","codec_tag":"0x31637661","width":1920,"height":1080,"has_b_frames":0,"sample_aspect_ratio":"0:1","display_aspect_ratio":"0:1","pix_fmt":"yuv420p","level":40,"r_frame_rate":"30\/1","avg_frame_rate":"21240000\/707831","time_base":"1\/90000","start_pts":0,"start_time":"0.000000","duration_ts":1415662,"duration":"15.729578","bit_rate":"16553536","nb_frames":"472","disposition":{"default":1,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0},"tags":{"rotate":"90","creation_time":"2013-12-24 10:19:18","language":"eng","handler_name":"VideoHandle"}}
简而言之,它是 1920x1080,16KK 比特率,旋转:90。
我正在通过以下命令使用 ffmpeg 对其进行转换:
ffmpeg -y -threads 8 -i input.mp4 -vcodec libx264 -vpre ipod640 -s 324x576 -strict -2 -b:v 512k -acodec aac -ac 1 -ar 16000 -ab 32000 -vf "transpose=1" -metadata:s:v:0 rotate=0 output.mp4
输出视频流信息:
{"index":0,"codec_name":"h264","codec_long_name":"H.264 \/ AVC \/ MPEG-4 AVC \/ MPEG-4 part 10","profile":"Constrained Baseline","codec_type":"video","codec_time_base":"1\/48","codec_tag_string":"avc1","codec_tag":"0x31637661","width":324,"height":576,"has_b_frames":0,"sample_aspect_ratio":"0:1","display_aspect_ratio":"0:1","pix_fmt":"yuv420p","level":30,"r_frame_rate":"24\/1","avg_frame_rate":"24\/1","time_base":"1\/12288","start_pts":0,"start_time":"0.000000","duration_ts":72192,"duration":"5.875000","bit_rate":"521597","nb_frames":"141","disposition":{"default":1,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0},"tags":{"language":"eng","handler_name":"VideoHandler"}}
输出视频在许多不同的设备和操作系统(包括不同的 iO 和 android)上播放没有任何问题,但三星 S5300 不播放。从设备日志中,我可以看到以下异常:
E/AwesomePlayer( 1349): This resolution [324X576] Not Supported
但是,当我将宽度和高度更改为 576x324 时,视频可以在 S5300 上播放,但旋转错误。
我应该在 ffmpeg 参数中添加什么以使其以正确的方向播放?
ffmpeg 版本:
ffmpeg version git-2013-12-22-911676c Copyright (c) 2000-2013 the FFmpeg developers built on Dec 22 2013 22:55:31 with gcc 4.4.5 (Debian 4.4.5-8)
谢谢
最佳答案
您可以添加黑色边距以获得目标分辨率。
例如ffmpeg -i in.mp4 -vf pad="704:576:(704-324)/2:0" out.mp4
(有关 pad
过滤器的更多信息,请参阅 http://www.ffmpeg.org/ffmpeg-filters.html#pad )
关于android - 在 LDPI 设备上播放 ffmpeg 转换的视频 (Samsung S5300 240 x 320),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20767175/