带有不同时基的ffmpeg concat视频 [英] ffmpeg concat videos with different timebase

查看:340
本文介绍了带有不同时基的ffmpeg concat视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用

ffmpeg.exe -f concat -i file_path_list_txt -c copy out_out.mp4

以进行

for file in 1265_*; do ffmpeg -i $file -crf 30 -b:a 23k -b:v 96k -threads 3 -y 'out_'$file; done

压缩视频。

当我播放生成的视频时,播放器显示视频长度比压缩视频片段的总和长得多。并且在切片之间的链接处,框架可以播放很长时间,播放器上的时间还在继续,但是框架仍然是。

When I play the generated video, the player shows the video length is much longer than the sum of compressed video pieces. And at the linkage between slices,the frame can play a very long time,time on the player is going on,but the frame is still.

我使用 ffprobe 显示原始视频片段和压缩视频片段。并找到具有相同 tbr,tbn,tbc 的原始视频,而压缩后没有。

I use ffprobe to show the original video pieces and compressed video pieces. And found the original videos with same tbr,tbn,tbc, while the compressed not.

原始视频:

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, progressive), 1600x1144, 134 kb/s, 8.17 fps, 600 tbr, 600 tbn, 1200 tbc (default)
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, progressive), 1600x1144, 138 kb/s, 9.73 fps, 600 tbr, 600 tbn, 1200 tbc (default)

压缩视频:

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1600x1144, 174 kb/s, 8.17 fps, 8.17 tbr, 245050 tbn, 16.33 tbc (default)
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1600x1144, 127 kb/s, 9.73 fps, 9.73 tbr, 1750800 tbn, 19.45 tbc (default)

当我连接时,在控制台中,ffmpeg显示以下信息:

And when I concat, in the console,ffmpeg show below info:

[mp4 @ 000001fe0193b700] Application provided duration: 2585263321 / timestamp: 6303355764 is out of range for mov/mp4 format
[mp4 @ 000001fe0193b700] pts has no value
[mp4 @ 000001fe0193b700] Application provided duration: 2585443321 / timestamp: 6303535765 is out of range for mov/mp4 format
[mp4 @ 000001fe0193b700] pts has no value

In根据我的情况,视频片段是逐次生成的,我不知道它何时停止,因此在压缩之前我无法做concat。每次生成视频片段时,我都会对其进行压缩并附加。

In my situation the video pieces are generated time by time, and I don't know when it stops, so I cannot do concat before compress. Each time a video piece generated I comress it and append it.

推荐答案

在压缩为MOV / MP4时,请设置一个常见的时标 tbn 使用 -video_track_timescale N 。对于您的输入,N = 600看起来不错。

When compressing to MOV/MP4, set a common timescale tbn using -video_track_timescale N. For your input, N=600 looks fine.

这篇关于带有不同时基的ffmpeg concat视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆