我无法将此视频文件 (mp4) 上传到 Twitter

Mar*_*sto 2 linux twitter video ffmpeg ubuntu-16.04

我尝试将视频文件 (mp4) 上传到 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
Run Code Online (Sandbox Code Playgroud)

这里是关于我试图上传的视频的一般信息,但 Twitter 一直说在处理它时出现问题(我通过 mediainfo 获得的信息):

General
Complete name                            : tmp03.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 6.71 MiB
Duration                                 : 2mn 15s
Overall bit rate mode                    : Constant
Overall bit rate                         : 417 Kbps
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00
Writing application                      : Lavf58.29.100

Video
ID                                       : 1
Format                                   : MPEG-4 Visual
Format profile                           : Simple@L1
Format settings, BVOP                    : No
Format settings, QPel                    : No
Format settings, GMC                     : No warppoints
Format settings, Matrix                  : Default (H.263)
Codec ID                                 : 20
Duration                                 : 2mn 15s
Bit rate mode                            : Constant
Bit rate                                 : 281 Kbps
Width                                    : 720 pixels
Height                                   : 405 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.032
Stream size                              : 4.52 MiB (67%)
Writing library                          : Lavc58.54.100
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 2mn 15s
Duration_LastFrame                       : -19ms
Bit rate mode                            : Constant
Bit rate                                 : 129 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Frame rate                               : 46.875 fps (1024 spf)
Compression mode                         : Lossy
Stream size                              : 2.07 MiB (31%)
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00
Run Code Online (Sandbox Code Playgroud)

你能告诉我视频文件有什么问题吗??

此致!

Teo*_*cci 7

我尝试了其他答案中的所有命令,但没有一个对我有用。所以,我决定做我自己的版本:

ffmpeg -i input.mov \
 -vcodec libx264 -pix_fmt yuv420p -strict experimental \
 -r 30 -t 2:20 \
 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -vb 1024k \
 -acodec aac -ar 44100 -ac 2\
 -minrate 1024k -maxrate 1024k -bufsize 1024k \
 -movflags +faststart \
 output.mp4
Run Code Online (Sandbox Code Playgroud)
  • 如果您的输入包含AAC 音频,您可以通过更改为流式复制而不是重新编码保持音频质量。-acodec aac -ar 44100 -ac 2-acodec copy
选项 解释
-vcodec libx264 选择视频编码器libx264
-pix_fmt yuv420p 确保 YUV 4:2:0 色度二次采样以实现兼容性
-strict experimental 允许非标准化实验事物、实验性(未完成/正在进行中/未经过充分测试)解码器和编码器
-r 30 将输出文件的帧速率设置为 30 fps
-t 2:20 将持续时间设置为 2 分 20 分钟。之后它将停止写入输出
-vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" 如果出现不能被 2 整除的错误,请参阅
-acodec aac 选择音频编码器aac
-minrate 1024k 将最小比特率容差设置为 1024k(以位/秒为单位)。否则就没啥用了
-maxrate 1024k 将最大比特率容差设置为 1024k(以位/秒为单位)。需要设置bufsize
-bufsize 1024k 将速率控制缓冲区大小设置为 1024k(以位为单位)
-movflags +faststart 启用流媒体快速启动


llo*_*gan 5

我猜它不喜欢 MPEG-4 Part 2 视频。这是一种传统的视频格式。重新编码为 H.264:

ffmpeg -i input.mp4 -c:v libx264 -crf 18 -c:a copy output.mp4
Run Code Online (Sandbox Code Playgroud)

如果你得到height not divisible by 2 (720x405)然后添加裁剪过滤器:

ffmpeg -i input.mp4 -c:v libx264 -crf 18 -vf crop=iw:ih-1 -c:a copy output.mp4
Run Code Online (Sandbox Code Playgroud)