gpt4 book ai didi

video - 如何使用ffmpeg连接具有不同宽度和高度的两个视频而不复制许多帧

转载 作者:行者123 更新时间:2023-12-04 23:19:16 30 4
gpt4 key购买 nike

我正在尝试将两个视频连接在一起,但每次我这样做时,这个过程永远不会完成并且永远不会结束。我也收到许多警告,例如 Frame rate very high for a muxer not efficiently supporting it. Please consider specifying a lower framerate, a different muxer or -vsync 2这是我运行的命令

ffmpeg -i /tmp/test-video.mp4 -i /tmp/test-video-1.mp4  \
-filter_complex "[0:v]scale=1920:1080[0v],[0v]setsar=ratio=1920/1080[0vf]; [1:v]scale=1920:1080[1v],[1v]setsar=ratio=1920/1080[1vf]; \
[0vf][0:a][1vf][1:a]concat=n=2:v=1:a=1[v][a]" \
-map "[v]" -map "[a]" -preset ultrafast res.mp4
这是运行我的命令的日志
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/test-video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.76.100
Duration: 00:00:32.79, start: 0.000000, bitrate: 1566 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 1434 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/test-video-1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
Duration: 00:00:09.06, start: 0.000000, bitrate: 805 kb/s
Stream #1:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1020x720 [SAR 1:1 DAR 17:12], 671 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 (h264) -> scale
Stream #0:1 (aac) -> concat:in0:a0
Stream #1:0 (h264) -> scale
Stream #1:1 (aac) -> concat:in1:a0
concat:out:v0 -> Stream #0:0 (libx264)
concat:out:a0 -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[mp4 @ 0x7ffb1e830400] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
[libx264 @ 0x7ffb1e838e00] using SAR=16/9
[libx264 @ 0x7ffb1e838e00] MB rate (8160000000) > level limit (16711680)
[libx264 @ 0x7ffb1e838e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7ffb1e838e00] profile Constrained Baseline, level 6.2, 4:2:0, 8-bit
# more logging hidden
More than 1000 frames duplicated 0kB time=00:00:00.25 bitrate= 1.5kbits/s speed=5.32x
More than 10000 frames duplicated 1280kB time=00:00:00.32 bitrate=32257.2kbits/s dup=39998 drop=0 speed=0.00393x
```

最佳答案

所以我解决它的方法是我添加了他们的建议,而不是添加 -vsync 2所以整个命令变成

ffmpeg -y -i /tmp/test-video.mp4 -i /tmp/test-video-1.mp4 -filter_complex \ 
"[0:v]scale=1920:1080[0v],
[0v]setsar=ratio=1920/1080[0vf]; [1:v]scale=1920:1080[1v], \
[1v]setsar=ratio=1920/1080[1vf];[0vf][0:a][1vf] \
[1:a]concat=n=2:v=1:a=1[v][a]" \
-map [v] -map [a] -vsync 2 -preset ultrafast res.mp4

关于video - 如何使用ffmpeg连接具有不同宽度和高度的两个视频而不复制许多帧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70115522/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com