video - 如何根据视频数据编写ffmpeg代码

标签 video ffmpeg encode

Format                      : MPEG-4
Format profile              : Base Media / Version 2
Codec ID                    : mp42 (isom/mp42)
File size                   : 337 MiB
Duration                    : 1 h 23 min
Overall bit rate mode       : Variable
Overall bit rate            : 562 kb/s
Encoded date                : UTC 2020-04-23 00:22:37
Tagged date                 : UTC 2020-04-23 00:22:37
gsst                        : 0
gstd                        : 5034271

Video
ID                          : 1
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : Main@L3.1
Format settings             : CABAC / 3 Ref Frames
Format settings, CABAC      : Yes
Format settings, Reference  : 3 frames
Codec ID                    : avc1
Codec ID/Info               : Advanced Video Coding
Duration                    : 1 h 23 min
Bit rate                    : 431 kb/s
Width                       : 1 280 pixels
Height                      : 720 pixels
Display aspect ratio        : 16:9
Frame rate mode             : Constant
Frame rate                  : 23.976 (24000/1001) FPS
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.019
Stream size                 : 258 MiB (77%)
Title                       : ISO Media file produced by Google Inc. Created on: 04/22/2020.
Writing library             : x264 core 155 r2901 7d0ff22
Encoded date                : UTC 2020-04-23 00:22:37
Tagged date                 : UTC 2020-04-23 00:22:37
Color range                 : Limited
Color primaries             : BT.709
Transfer characteristics    : BT.709
Matrix coefficients         : BT.709
Codec configuration box     : avcC

Audio
ID                          : 2
Format                      : AAC LC
Format/Info                 : Advanced Audio Codec Low Complexity
Codec ID                    : mp4a-40-2
Duration                    : 1 h 23 min
Bit rate mode               : Variable
Bit rate                    : 128 kb/s
Channel(s)                  : 2 channels
Channel layout              : L R
Sampling rate               : 44.1 kHz
Frame rate                  : 43.066 FPS (1024 SPF)
Compression mode            : Lossy
Stream size                 : 76.8 MiB (23%)
Title                       : ISO Media file produced by Google Inc. Created on: 04/22/2020.
Encoded date                : UTC 2020-04-23 00:22:37
Tagged date                 : UTC 2020-04-23 00:22:37

我有这些信息,我想用 ffmpeg 得到相同的结果。我应该怎么办?我必须使用哪些代码?

提前致谢...

最佳答案

不确定您为什么要这样做,但使用这些命令将模拟大多数细节。

模拟问题中显示的信息的命令

ffmpeg -i input.mp4 -c:v libx264 -preset slow -profile:v main -level 3.1 -refs 3 -color_primaries bt709 -colorspace bt709 -color_trc bt709 -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1,setsar=1,fps=24000/1001,format=yuv420p" -b:v 431k -c:a aac -ac 2 -ar 44100 -movflags +faststart -brand mp42 output.mp4

命令模拟您对我的回答的评论中显示的信息
ffmpeg -i input.mp4 -c:v libx264 -level 4 -refs 3 -color_primaries bt709 -colorspace bt709 -color_trc bt709 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1,setsar=1,fps=24,format=yuv420p" -c:a aac -ac 2 -ar 44100 -movflags +faststart output.mp4

关于video - 如何根据视频数据编写ffmpeg代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61429162/

相关文章:

video - 用于托管、管理和流式传输视频的软件

javascript - 视频循环几次后停止

audio - 仅将音频混合到 MP4 ffmpeg 失败

javascript - 将 C# View 模型转换为 JavaScript 模型时转义 HTML 标签

linux - 无法使用 Linux 中的文本编辑器删除前两个编码字符

iphone - 使用 UIImage 和 caf 创建视频文件的问题

javascript - Html 视频支持不同的视频 src 类型

使用 "Option pixel_format not found"时 FFMpeg 打印 "pix_fmt"

ffmpeg - JavaFX MediaPlayer 无法播放本地 m3u8 文件

image - PNG IDAT 规范