在LDPI设备上播放ffmpeg转换后的视频(Samsung S5300 240 x 320)

时间:2013-12-24 21:58:54

标签: android video ffmpeg

我有三星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和机器人)上播放输出视频没有任何问题,但三星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)

由于

1 个答案:

答案 0 :(得分:0)

您可以添加黑色边距以获得目标分辨率。

例如

ffmpeg -i in.mp4 -vf pad="704:576:(704-324)/2:0" out.mp4

(有关pad过滤器的详细信息,请参阅http://www.ffmpeg.org/ffmpeg-filters.html#pad