我想将一个位图连接到许多视频的前面,作为标题屏幕或免责声明屏幕。
我尝试将其转换为具有与其余视频相同属性的视频。所以首先我对视频进行内省:
ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 11 2014 22:50:38 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'EO1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.78.3
Duration: 00:00:17.77, start: 0.000000, bitrate: 582 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 584x328 [SAR 1:1 DAR 73:41], 512 kb/s, 23.98 fps, 23.98 tbr, 1199 tbn, 47.96 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
然后,我尝试创建一个类似的文件:
/usr/local/Cellar/ffmpeg/2.2.1/bin/ffmpeg -y -loop 1 -i Disclaimer.png -c:v libx264 -r 23.98 -t 5 -pix_fmt yuv420p -profile:v main disclaimer.mp4
看来还可以。我会期望视频播放。这些属性非常相似。这是一个差异:
< Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'disclaimer.mp4':
---
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'EO1.mp4':
18,20c18,21
< encoder : Lavf55.33.100
< Duration: 00:00:05.01, start: 0.000000, bitrate: 21 kb/s
< Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 584x328 [SAR 1:1 DAR 73:41], 17 kb/s, 23.98 fps, 23.98 tbr, 19184 tbn, 47.96 tbc (default)
---
> creation_time : 1970-01-01 00:00:00
> encoder : Lavf52.78.3
> Duration: 00:00:17.77, start: 0.000000, bitrate: 582 kb/s
> Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 584x328 [SAR 1:1 DAR 73:41], 512 kb/s, 23.98 fps, 23.98 tbr, 1199 tbn, 47.96 tbc (default)
21a23
22a25,28
> Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s (default)
> Metadata:
> handler_name : SoundHandler
但是,当我尝试连接时,会出现错误。
> $ cat temporary.txt
file disclaimer.mp4
file EO1.mp4
/usr/local/Cellar/ffmpeg/2.2.1/bin/ffmpeg -y -f concat -i临时.txt -c复制output.mp4
[concat @ 0x7fd880806600] Estimating duration from bitrate, this may be inaccurate
Input #0, concat, from 'temporary.txt':
Duration: 00:00:00.02, start: 0.000000, bitrate: 17 kb/s
Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 584x328 [SAR 1:1 DAR 73:41], 17 kb/s, 23.98 fps, 23.98 tbr, 19184 tbn, 47.96 tbc
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf55.33.100
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 584x328 [SAR 1:1 DAR 73:41], q=2-31, 17 kb/s, 23.98 fps, 19184 tbn, 19184 tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x7fd880829a00] Non-monotonous DTS in output stream 0:0; previous: 93600, current: 5951; changing to 93601. This may result in incorrect timestamps in the output file.
[concat @ 0x7fd880806600] Invalid stream index 1
[mp4 @ 0x7fd880829a00] Non-monotonous DTS in output stream 0:0; previous: 93601, current: 6001; changing to 93602. This may result in incorrect timestamps in the output file.
[concat @ 0x7fd880806600] Invalid stream index 1
[mp4 @ 0x7fd880829a00] Non-monotonous DTS in output stream 0:0; previous: 93602, current: 6051; changing to 93603. This may result in incorrect timestamps in the output file.
...
frame= 546 fps=0.0 q=-1.0 Lsize= 1127kB time=00:00:04.90 bitrate=1882.9kbits/s
video:1123kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.349865%
输出看起来只包含我的免责声明文件,而不包含视频的其余部分。
我也很困惑为什么感觉需要“估计”任何东西。它知道输入FPS和输入持续时间。我不确定这是否是问题。也许只是一个错误。
我的另一个选择是使用“ concat过滤器”,但这是有损的转码,对吗?我希望第二个视频在连接后与以前完全一样。
编辑:最终尝试了concat“协议”,这是第三个选项。该文档不鼓励使用它,但它比其他两个(Concat demuxer和concat过滤器)效果更好。
-r 23.98
您应该使用-r 24000/1001
或-r ntsc-film
(除非其他视频当然是使用创建的-r 23.98
)。但是,这可能无法解决当前问题。