ffmpeg 视频缩放和填充使其适用于 Twitter

ffmpeg 视频缩放和填充使其适用于 Twitter

我正在尝试将视频转换为以便将其上传到 Twitter。Twitter 的要求如下:

File Type: MP4 or MOV
Max Time: 2 minutes and 20 seconds
Minimum Resolution: 32 x 32
Maximum Resolution: 1920 x 1200
Aspect Ratios: 1:2.39 - 2.39:1 range (inclusive)
Maximum Frame rate: 40 fps
Maximum Video Bitrate: 25 Mbps

原始分辨率为 3600x1200,但运行后

ffmpeg -i 输出.mp4 -filter:v "scale='min(1280,iw)':min'(720,ih)':force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2" output_twitter.mp4

当我使用 GUI 播放器打开它时,它仍然没有改变宽高比(视觉上)(尽管分辨率似乎较低)。但是,从命令行,媒体信息似乎表明输出分辨率现在是 1280x720:

mediainfo output_twitter.mp4  

General
Complete name                            : output_twitter.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 842 KiB
Duration                                 : 24 s 0 ms
Overall bit rate                         : 287 kb/s
Writing application                      : Lavf57.83.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High 4:4:4 [email protected]
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 24 s 0 ms
Bit rate                                 : 285 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Original display aspect ratio            : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Chroma subsampling                       : 4:4:4
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.012
Stream size                              : 834 KiB (99%)
Writing library                          : x264 core 152 r2854 e9a5903
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=4 / threads=22 / lookahead_threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Twitter 仍然不接受它。你知道我做错了什么吗?谢谢

编辑:您可以在此处下载视频:https://wetransfer.com/downloads/c2a0143ca4f0a2a7b8bac0de36dd2cf620200228175053/ab0c28e7f09cb456b2cf30c9bb7827dc20200228175053/440f1f

答案1

大多数平台不喜欢全色度格式,因此添加-pix_fmt yuv420p。其余参数看起来可以接受。

相关内容