简体   繁体   English

使用 FFMPEG 连接视频:Glitchy\\Desync 输出

[英]Concatenate Videos using FFMPEG : Glitchy\Desync output

I have a folder containing multiple video clips (including the Outro, which is an mp4 video).我有一个包含多个视频剪辑的文件夹(包括 Outro,它是一个 mp4 视频)。 I'm running this code to concatenate the videos :我正在运行此代码来连接视频:

os.system("(for %i in (*.mp4) do @echo file '%i') > mylist.txt")
os.system('more +1 "mylist.txt" > "Final_List.txt"')
os.system("echo file 'Outro.mp4' >> Final_List.txt") #Final_list.txt will contain all the videos' paths, and will have the outro's path on its last line.
os.system("ffmpeg -f concat -i Final_List.txt -c copy output.mp4")

After executing that, I get a video named output.mp4 containing all the clips I concatenated, but the outro is very buggy : The original outro.mp4 video lasts 9 seconds but on the final video, it only lasts 2 seconds and the sound is accelerated a lot.执行后,我得到一个名为 output.mp4 的视频,其中包含我连接的所有剪辑,但 outro 非常有问题:原始 outro.mp4 视频持续 9 秒,但在最终视频中,它只持续 2 秒,声音是加速了很多。

https://gofile.io/d/zqadc2 #You'll find the outro.mp4 file here, as well as some of the clips that were correctly concatenated https://gofile.io/d/zqadc2 #你会在这里找到outro.mp4文件,以及一些正确连接的剪辑

https://gofile.io/d/G9Zbjo #You'll find the output.mp4 video here https://gofile.io/d/G9Zbjo #你会在这里找到 output.mp4 视频

Input file info:输入文件信息:

ffmpeg -i Ready_clip7.mp4 -i Ready_clip15.mp4 -i Outro.mp4
...
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Ready_clip7.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.51.101
  Duration: 00:00:06.40, start: 0.000000, bitrate: 1476 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1339 kb/s, SAR 24251:24253 DAR 388016:218277, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'Ready_clip15.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.51.101
  Duration: 00:00:18.11, start: 0.000000, bitrate: 1125 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 2043:2048 DAR 227:128], 1009 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 108 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'Outro.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.51.101
  Duration: 00:00:32.02, start: 0.000000, bitrate: 188 kb/s
    Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 52 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

All inputs must have the same attributes for best results.为了获得最佳结果,所有输入必须具有相同的属性。

Yours vary in width, height, frame rate, and audio sample rate.您的宽度、高度、帧速率和音频采样率各不相同。

Conform Outro.mp4 so it matches the other files:符合Outro.mp4使其与其他文件匹配:

ffmpeg -i Outro.mp4 -vf "scale=1280:720,fps=30" -ar 48000 Outro2.mp4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM