Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

ffmpeg concat videos with different timebase

I use

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

to concat

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

compressed video.

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.

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.

Original videos:

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)

Compressed videos:

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)

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 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...