I'm concatenating 2 video files 00000 and 00001:
How can I keep the framerate of the files constant?Code:ffmpeg -y -f concat -safe 0 -i file_list.txt -loglevel error -c copy test.mp4 file_list.txt: file '00000.mp4' file '00001.mp4' 00000.mp4: Duration: 00:00:00.42, start: 0.000000, bitrate: 204 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 182 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default) 00001.mp4: Duration: 00:00:01.63, start: 0.000000, bitrate: 58 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 48 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default) The result has a different framerate: test.mp4: Duration: 00:00:02.05, start: 0.000000, bitrate: 85 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 76 kb/s, 59.99 fps, 60 tbr, 15360 tbn, 120 tbc (default)
I checked for a VFR:
Is it possible to get VFR:0 after the concatenation?Code:ffmpeg -i 00000.mp4 -vf vfrdet -an -f null - VFR:0.000000 (0/24) ffmpeg -i 00001.mp4 -vf vfrdet -an -f null - VFR:0.000000 (0/97) ffmpeg -i test.mp4 -vf vfrdet -an -f null - VFR:0.016393 (2/120) min: 256 max: 261 avg: 258
+ Reply to Thread
Results 1 to 22 of 22
-
Last edited by qo4on; 26th Apr 2020 at 04:33.
-
-
The bitrate does not matter.
There is no audio in his example
@qo4on - the timestamps in the output file in the 2nd section have problems with rounding errors and jitter for some reason, even though both input files do not
Not sure if there is a magic switch in ffmpeg to do this;
Some options - you can fix the timecodes afterwards using mp4fpsmod, or use another method to join such as mp4box
eg mp4fpsmod using "inplace" editing mode (inplace mode overwrites the timecodes in the file, but you can use copy mode using -o to specify another output file instead to be safe)
Code:"mp4fpsmod" --fps 0:60 "test.mp4" --inplace
-
00000.mp4:
Duration: 00:00:00.42, start: 0.000000, bitrate: 204 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 182 kb/s
00001.mp4:
Duration: 00:00:01.63, start: 0.000000, bitrate: 58 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 48 kb/s -
That's a video stream 0:0 .
There is no audio stream, otherwise the ffmpeg stream list would say 0:1 or other tracks.
He posted the videos, you can download them if you want to check
The bitrate difference is from MP4 container overhead, it's an estimated value -
-
first remuxing to transport streams and then appending the files might work,...
something along the lines of
Code:ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
Cu Selurusers currently on my ignore list: deadrats, Stears555, marcorocchini -
-
If your original files were 60.0FPS CFR (Not 59.94, otherwise you change it to --fps 0:60000/1001) , and audio, and video were exact (not one stream slightly longer, such as video 1 frame longer, or audio gaps, then it should work.
This just fixes the jitter in the timecodes that ffmpeg produced. If one or more source files had problems, and ffmpeg relied on those VFR timecodes to keep things in sync, then changing it to CFR can cause it to go slightly in and out of sync in sections -
@poisondeathray Can I install mp4fpsmod on Windows? I didn't find an installer.
-
No "installer" ;
It's a "portable" exe like ffmpeg static complied windows binaries
There is a compiled binary here
https://sites.google.com/site/qaacpage/cabinet
Unzip it -
@poisondeathray thank you very much!
I found a few problems here:
1. tbn has changed from 15360 to 6k.
2. I tested it with hevc mp4 files with audio. I extracted wav from both files before and after and opened them in Audition. Before 7.291 sec, after 7.337 sec. The audio was shifted to the end and silence was added to the beginning. I opened both before and after hevc mp4 files in Premiere Pro and see this silence at the beginning also. ffprobe shows Duration: 00:00:07.32 for both files.
Code:ffmpeg -i before.mp4 -vf vfrdet -an -f null - Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'before.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.42.100 Duration: 00:00:07.32, start: 0.000000, bitrate: 4293 kb/s Stream #0:0(und): Video: hevc (Rext) (hev1 / 0x31766568), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4237 kb/s, 59.93 fps, 59.94 tbr, 15360 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 120 kb/s (default) Metadata: handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native)) Press [q] to stop, [?] for help Output #0, null, to 'pipe:': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.42.100 Stream #0:0(und): Video: wrapped_avframe, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 59.94 fps, 59.94 tbn, 59.94 tbc (default) Metadata: handler_name : VideoHandler encoder : Lavc58.80.100 wrapped_avframe frame= 431 fps=0.0 q=-0.0 Lsize=N/A time=00:00:07.19 bitrate=N/A speed=10.3x video:226kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown [Parsed_vfrdet_0 @ 000001ddc245ee80] VFR:0.079070 (34/396) min: 256 max: 267 avg: 259 ffmpeg -i after.mp4 -vf vfrdet -an -f null - Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'after.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.42.100 Duration: 00:00:07.32, start: 0.000000, bitrate: 4293 kb/s Stream #0:0(und): Video: hevc (Rext) (hev1 / 0x31766568), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4242 kb/s, 60 fps, 60 tbr, 6k tbn, 60 tbc (default) Metadata: creation_time : 2020-04-26T18:21:58.000000Z handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 120 kb/s (default) Metadata: handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native)) Press [q] to stop, [?] for help Output #0, null, to 'pipe:': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.42.100 Stream #0:0(und): Video: wrapped_avframe, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc (default) Metadata: creation_time : 2020-04-26T18:21:58.000000Z handler_name : VideoHandler encoder : Lavc58.80.100 wrapped_avframe frame= 431 fps=0.0 q=-0.0 Lsize=N/A time=00:00:07.18 bitrate=N/A speed=10.4x video:226kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown [Parsed_vfrdet_0 @ 000001cf2becd600] VFR:0.000000 (0/430)
-
What was the original before "before.mp4" ? 2 or more joined files ?
Examine the timecodes (aka. timestamps) of the before and after
If the VFR is required for sync, then you need to keep it VFR . Or reencode it to CFR (inserting frames) ,stream copy will not work in that case -
"before.mp4" was 23 CFR clips concatenated with ffmpeg and then audio was added after the concatenation. ffprobe for each clip:
Code:Duration: 00:00:00.12, start: 0.000000, bitrate: 5429 kb/s Stream #0:0(und): Video: hevc (Rext) (hev1 / 0x31766568), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 5381 kb/s, 60 fps, 60 tbr, 15360 tbn, 60 tbc (default) ffmpeg -i 00000.mp4 -vf vfrdet -an -f null - Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '00000.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.42.100 Duration: 00:00:00.12, start: 0.000000, bitrate: 5429 kb/s Stream #0:0(und): Video: hevc (Rext) (hev1 / 0x31766568), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 5381 kb/s, 60 fps, 60 tbr, 15360 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native)) Press [q] to stop, [?] for help Output #0, null, to 'pipe:': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.42.100 Stream #0:0(und): Video: wrapped_avframe, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler encoder : Lavc58.80.100 wrapped_avframe frame= 7 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.11 bitrate=N/A speed=2.49x video:4kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown [Parsed_vfrdet_0 @ 000002a106f21200] VFR:0.000000 (0/6)
Code:ffprobe before.mp4 ffprobe after.mp4 -select_streams v -select_streams v -show_entries frame= -show_entries frame= coded_picture_number, coded_picture_number, pkt_pts_time -of pkt_pts_time -of csv=p=0:nk=1 -v 0 csv=p=0:nk=1 -v 0 0.000000,0 0.000000,0 0.016667,0 0.016667,0 0.033333,0 0.033333,0 0.050000,0 0.050000,0 0.066667,0 0.066667,0 0.083333,0 0.083333,0 0.100000,0 0.100000,0 0.116992,0 0.116667,0 0.133659,0 0.133333,0 0.150326,0 0.150000,0 0.166992,0 0.166667,0 0.183659,0 0.183333,0 0.200326,0 0.200000,0 0.216992,0 0.216667,0 0.233659,0 0.233333,0 0.250326,0 0.250000,0 0.266992,0 0.266667,0 0.283659,0 0.283333,0 0.300326,0 0.300000,0 0.316992,0 0.316667,0 0.333659,0 0.333333,0 0.350326,0 0.350000,0 0.366992,0 0.366667,0 0.383659,0 0.383333,0 0.400326,0 0.400000,0 0.416992,0 0.416667,0 0.433659,0 0.433333,0 0.450326,0 0.450000,0 0.466992,0 0.466667,0 0.483659,0 0.483333,0 0.500326,0 0.500000,0 0.516992,0 0.516667,0 0.533659,0 0.533333,0 0.550977,0 0.550000,0 0.567643,0 0.566667,0 0.584310,0 0.583333,0 0.600977,0 0.600000,0 0.617643,0 0.616667,0 0.634310,0 0.633333,0 0.650977,0 0.650000,0 0.667643,0 0.666667,0 0.685026,0 0.683333,0 0.701693,0 0.700000,0 0.718359,0 0.716667,0 0.735026,0 0.733333,0 0.751693,0 0.750000,0 0.768359,0 0.766667,0 0.785026,0 0.783333,0 0.801693,0 0.800000,0 0.818359,0 0.816667,0 0.835026,0 0.833333,0 0.851693,0 0.850000,0 0.868359,0 0.866667,0 0.885026,0 0.883333,0 0.901693,0 0.900000,0 0.918359,0 0.916667,0 0.935026,0 0.933333,0 0.951693,0 0.950000,0 0.968359,0 0.966667,0 0.985026,0 0.983333,0 1.001693,0 1.000000,0 1.018359,0 1.016667,0 1.035026,0 1.033333,0 1.051693,0 1.050000,0 1.068359,0 1.066667,0 1.085026,0 1.083333,0 1.101693,0 1.100000,0 1.118359,0 1.116667,0 1.135026,0 1.133333,0 1.152018,0 1.150000,0 1.168685,0 1.166667,0 1.185352,0 1.183333,0 1.202018,0 1.200000,0 1.218685,0 1.216667,0 1.235352,0 1.233333,0 1.252018,0 1.250000,0 1.268685,0 1.266667,0 1.286003,0 1.283333,0 1.302669,0 1.300000,0 1.319336,0 1.316667,0 1.336003,0 1.333333,0 1.352669,0 1.350000,0 1.369336,0 1.366667,0 1.386003,0 1.383333,0 1.402669,0 1.400000,0 1.419336,0 1.416667,0 1.436003,0 1.433333,0 1.452669,0 1.450000,0 1.469336,0 1.466667,0 1.486003,0 1.483333,0 1.502669,0 1.500000,0 1.519336,0 1.516667,0 1.536003,0 1.533333,0 1.552669,0 1.550000,0 1.569336,0 1.566667,0 1.586003,0 1.583333,0 1.602669,0 1.600000,0 1.619336,0 1.616667,0 1.636003,0 1.633333,0 1.652669,0 1.650000,0 1.669336,0 1.666667,0 1.686003,0 1.683333,0 1.702669,0 1.700000,0 1.719336,0 1.716667,0 1.736003,0 1.733333,0 1.752669,0 1.750000,0 1.769336,0 1.766667,0 1.786003,0 1.783333,0 1.802669,0 1.800000,0 1.819336,0 1.816667,0 1.836003,0 1.833333,0 1.852669,0 1.850000,0 1.869336,0 1.866667,0 1.886003,0 1.883333,0 1.902995,0 1.900000,0 1.919661,0 1.916667,0 1.936328,0 1.933333,0 1.952995,0 1.950000,0 1.969661,0 1.966667,0 1.986328,0 1.983333,0 2.002995,0 2.000000,0 2.019661,0 2.016667,0 2.036328,0 2.033333,0 2.052995,0 2.050000,0 2.069661,0 2.066667,0 2.086328,0 2.083333,0 2.102995,0 2.100000,0 2.119661,0 2.116667,0 2.136328,0 2.133333,0 2.152995,0 2.150000,0 2.169661,0 2.166667,0 2.186328,0 2.183333,0 2.202995,0 2.200000,0 2.219661,0 2.216667,0 2.236328,0 2.233333,0 2.252995,0 2.250000,0 2.269661,0 2.266667,0 2.286328,0 2.283333,0 2.302995,0 2.300000,0 2.319661,0 2.316667,0 2.336328,0 2.333333,0 2.352995,0 2.350000,0 2.369661,0 2.366667,0 2.386328,0 2.383333,0 2.402995,0 2.400000,0 2.419661,0 2.416667,0 2.436328,0 2.433333,0 2.452995,0 2.450000,0 2.469661,0 2.466667,0 2.486979,0 2.483333,0 2.503646,0 2.500000,0 2.520313,0 2.516667,0 2.536979,0 2.533333,0 2.553646,0 2.550000,0 2.570312,0 2.566667,0 2.586979,0 2.583333,0 2.603646,0 2.600000,0 2.620312,0 2.616667,0 2.636979,0 2.633333,0 2.653646,0 2.650000,0 2.670313,0 2.666667,0 2.686979,0 2.683333,0 2.703646,0 2.700000,0 2.720312,0 2.716667,0 2.736979,0 2.733333,0 2.753646,0 2.750000,0 2.770313,0 2.766667,0 2.786979,0 2.783333,0 2.803646,0 2.800000,0 2.820312,0 2.816667,0 2.836979,0 2.833333,0 2.853646,0 2.850000,0 2.870312,0 2.866667,0 2.886979,0 2.883333,0 2.903646,0 2.900000,0 2.920313,0 2.916667,0 2.936979,0 2.933333,0 2.953971,0 2.950000,0 2.970638,0 2.966667,0 2.987305,0 2.983333,0 3.003971,0 3.000000,0 3.020638,0 3.016667,0 3.037305,0 3.033333,0 3.053971,0 3.050000,0 3.070638,0 3.066667,0 3.088021,0 3.083333,0 3.104687,0 3.100000,0 3.121354,0 3.116667,0 3.138021,0 3.133333,0 3.154688,0 3.150000,0 3.171354,0 3.166667,0 3.188021,0 3.183333,0 3.204687,0 3.200000,0 3.221354,0 3.216667,0 3.238021,0 3.233333,0 3.254687,0 3.250000,0 3.271354,0 3.266667,0 3.288021,0 3.283333,0 3.304688,0 3.300000,0 3.321354,0 3.316667,0 3.338021,0 3.333333,0 3.354687,0 3.350000,0 3.371354,0 3.366667,0 3.388021,0 3.383333,0 3.404688,0 3.400000,0 3.421354,0 3.416667,0 3.438021,0 3.433333,0 3.454687,0 3.450000,0 3.471354,0 3.466667,0 3.488021,0 3.483333,0 3.504687,0 3.500000,0 3.521354,0 3.516667,0 3.538021,0 3.533333,0 3.554688,0 3.550000,0 3.571354,0 3.566667,0 3.588021,0 3.583333,0 3.604687,0 3.600000,0 3.621354,0 3.616667,0 3.638021,0 3.633333,0 3.654688,0 3.650000,0 3.671354,0 3.666667,0 3.688021,0 3.683333,0 3.705013,0 3.700000,0 3.721680,0 3.716667,0 3.738346,0 3.733333,0 3.755013,0 3.750000,0 3.771680,0 3.766667,0 3.788346,0 3.783333,0 3.805013,0 3.800000,0 3.821680,0 3.816667,0 3.838346,0 3.833333,0 3.855013,0 3.850000,0 3.871680,0 3.866667,0 3.888346,0 3.883333,0 3.905013,0 3.900000,0 3.921680,0 3.916667,0 3.938346,0 3.933333,0 3.955013,0 3.950000,0 3.971680,0 3.966667,0 3.988346,0 3.983333,0 4.005013,0 4.000000,0 4.021680,0 4.016667,0 4.038346,0 4.033333,0 4.055013,0 4.050000,0 4.071680,0 4.066667,0 4.088346,0 4.083333,0 4.105013,0 4.100000,0 4.121680,0 4.116667,0 4.138346,0 4.133333,0 4.155013,0 4.150000,0 4.171680,0 4.166667,0 4.188346,0 4.183333,0 4.205013,0 4.200000,0 4.221680,0 4.216667,0 4.238346,0 4.233333,0 4.255013,0 4.250000,0 4.271680,0 4.266667,0 4.288997,0 4.283333,0 4.305664,0 4.300000,0 4.322331,0 4.316667,0 4.338997,0 4.333333,0 4.355664,0 4.350000,0 4.372331,0 4.366667,0 4.388997,0 4.383333,0 4.405664,0 4.400000,0 4.422331,0 4.416667,0 4.438997,0 4.433333,0 4.455664,0 4.450000,0 4.472331,0 4.466667,0 4.488997,0 4.483333,0 4.505664,0 4.500000,0 4.522331,0 4.516667,0 4.538997,0 4.533333,0 4.555664,0 4.550000,0 4.572331,0 4.566667,0 4.588997,0 4.583333,0 4.605664,0 4.600000,0 4.622331,0 4.616667,0 4.638997,0 4.633333,0 4.655664,0 4.650000,0 4.672331,0 4.666667,0 4.688997,0 4.683333,0 4.705664,0 4.700000,0 4.722331,0 4.716667,0 4.738997,0 4.733333,0 4.755990,0 4.750000,0 4.772656,0 4.766667,0 4.789323,0 4.783333,0 4.805990,0 4.800000,0 4.822656,0 4.816667,0 4.839323,0 4.833333,0 4.855990,0 4.850000,0 4.872656,0 4.866667,0 4.889974,0 4.883333,0 4.906641,0 4.900000,0 4.923307,0 4.916667,0 4.939974,0 4.933333,0 4.956641,0 4.950000,0 4.973307,0 4.966667,0 4.989974,0 4.983333,0 5.006641,0 5.000000,0 5.023307,0 5.016667,0 5.039974,0 5.033333,0 5.056641,0 5.050000,0 5.073307,0 5.066667,0 5.089974,0 5.083333,0 5.106641,0 5.100000,0 5.123307,0 5.116667,0 5.139974,0 5.133333,0 5.156641,0 5.150000,0 5.173307,0 5.166667,0 5.189974,0 5.183333,0 5.206641,0 5.200000,0 5.223307,0 5.216667,0 5.239974,0 5.233333,0 5.256641,0 5.250000,0 5.273307,0 5.266667,0 5.289974,0 5.283333,0 5.306641,0 5.300000,0 5.323307,0 5.316667,0 5.339974,0 5.333333,0 5.356641,0 5.350000,0 5.373307,0 5.366667,0 5.389974,0 5.383333,0 5.406641,0 5.400000,0 5.423307,0 5.416667,0 5.439974,0 5.433333,0 5.456641,0 5.450000,0 5.473307,0 5.466667,0 5.489974,0 5.483333,0 5.507031,0 5.500000,0 5.523698,0 5.516667,0 5.540365,0 5.533333,0 5.557031,0 5.550000,0 5.573698,0 5.566667,0 5.590365,0 5.583333,0 5.607031,0 5.600000,0 5.623698,0 5.616667,0 5.640365,0 5.633333,0 5.657031,0 5.650000,0 5.673698,0 5.666667,0 5.690365,0 5.683333,0 5.707031,0 5.700000,0 5.723698,0 5.716667,0 5.740365,0 5.733333,0 5.757031,0 5.750000,0 5.773698,0 5.766667,0 5.790365,0 5.783333,0 5.807031,0 5.800000,0 5.823698,0 5.816667,0 5.840365,0 5.833333,0 5.857031,0 5.850000,0 5.873698,0 5.866667,0 5.890365,0 5.883333,0 5.907031,0 5.900000,0 5.923698,0 5.916667,0 5.940365,0 5.933333,0 5.957031,0 5.950000,0 5.973698,0 5.966667,0 5.990365,0 5.983333,0 6.007031,0 6.000000,0 6.023698,0 6.016667,0 6.040365,0 6.033333,0 6.057031,0 6.050000,0 6.073698,0 6.066667,0 6.091016,0 6.083333,0 6.107682,0 6.100000,0 6.124349,0 6.116667,0 6.141016,0 6.133333,0 6.157682,0 6.150000,0 6.174349,0 6.166667,0 6.191016,0 6.183333,0 6.207682,0 6.200000,0 6.224349,0 6.216667,0 6.241016,0 6.233333,0 6.257682,0 6.250000,0 6.274349,0 6.266667,0 6.291016,0 6.283333,0 6.307682,0 6.300000,0 6.324349,0 6.316667,0 6.341016,0 6.333333,0 6.357682,0 6.350000,0 6.374349,0 6.366667,0 6.391016,0 6.383333,0 6.407682,0 6.400000,0 6.424349,0 6.416667,0 6.441016,0 6.433333,0 6.457682,0 6.450000,0 6.474349,0 6.466667,0 6.491016,0 6.483333,0 6.507682,0 6.500000,0 6.524349,0 6.516667,0 6.541016,0 6.533333,0 6.558008,0 6.550000,0 6.574674,0 6.566667,0 6.591341,0 6.583333,0 6.608008,0 6.600000,0 6.624674,0 6.616667,0 6.641341,0 6.633333,0 6.658008,0 6.650000,0 6.674674,0 6.666667,0 6.691992,0 6.683333,0 6.708659,0 6.700000,0 6.725326,0 6.716667,0 6.741992,0 6.733333,0 6.758659,0 6.750000,0 6.775326,0 6.766667,0 6.791992,0 6.783333,0 6.808659,0 6.800000,0 6.825326,0 6.816667,0 6.841992,0 6.833333,0 6.858659,0 6.850000,0 6.875326,0 6.866667,0 6.891992,0 6.883333,0 6.908659,0 6.900000,0 6.925326,0 6.916667,0 6.941992,0 6.933333,0 6.958659,0 6.950000,0 6.975326,0 6.966667,0 6.991992,0 6.983333,0 7.008659,0 7.000000,0 7.025326,0 7.016667,0 7.041992,0 7.033333,0 7.058659,0 7.050000,0 7.075326,0 7.066667,0 7.091992,0 7.083333,0 7.108659,0 7.100000,0 7.125326,0 7.116667,0 7.141992,0 7.133333,0 7.158659,0 7.150000,0 7.175326,0 7.166667,0
There is no reason for VFR when concatenating CFR with stream copy. I suppose ffmpeg has a bug in concat function, it adds jitter.
I need another tool for concatenation. As I know mp4box has a limit of 20 files for -cat operations. I need to concat thousands. Do you know how I can do that? I thought it's a trivial thing to do.
Or maybe you know how to set the "distance" between the last frame of the previous clip and the first frame of the next clip in ffmpeg concat?Last edited by qo4on; 27th Apr 2020 at 08:15.
-
I mentioned that earlier - when you have no audio, the 2nd video has "jitter" in the timestamps. There should be no reason why 2 separate CFR video only streams become VFR when appended. In that example, is there a sync issue? You can't tell because you have no audio stream
But when you have audio, there might be a reason for VFR - e.g. audio or video slightly shorter or longer on one or more files. The more clips, the more out of sync it can potentially become. Each individual clip might have slight "overhang" for either audio or video. No problem for 1 clip. But when you join them, you will get gaps unless you correct for them. VFR is one way of doing that - it slows down or speeds up playback, to correct for that gap area
If you have something like this, then mp4box will not work perfectly either. The audio has to be perfectly cut along samples aligning to video timestamps. For 60.0fps the "granulation" is 16.6667ms per frame. If you reset the timestamps to CFR, you lose the small VFR corrections in between joins, instead assume a single average, constant frame rate and it will have sync problems
I need another tool for concatenation. As I know mp4box has a limit of 20 files for -cat operations. I need to concat thousands. Do you know how I can do that? I thought it's a trivial thing to do.
Did you try it? If your clips are do not have exact with flush ends for audio and video , I expect that mp4box will not work well either. VFR would be required for sync, or you need to edit each clip so ends are flush
Or maybe you know how to set the "distance" between the last frame of the previous clip and the first frame of the next clip in ffmpeg concat? -
There is no audio in the input files. Audio is added after the concatenation.
The steps:
Code:00000.mp4, 00001.mp4... - CFR no audio ffmpeg concat... output.mp4 - no audio add audio to output.mp4... before.mp4
Code:Duration: 00:00:07.32, start: 0.000000, bitrate: 4293 kb/s Stream #0:0(und): Video: hevc (Rext) (hev1 / 0x31766568), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4237 kb/s, 59.93 fps, 59.94 tbr, 15360 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 120 kb/s (default) Metadata: handler_name : SoundHandler
Last edited by qo4on; 27th Apr 2020 at 11:31.
-
Maybe I missed something, but did you try to remux (or convert) the files into a .ts (or .m2ts) container before concatenating these intermediate .ts files? It helped here, the concatenated .mp4 is still reported as VFR by mediainfo, however audio and video stay in sync. (I didn't concatenate 100's of files though ........ ).
-
@Sharc
Thanks for your help.
I'm trying to do this without additional encoding, converting... All I need is to change the metadata of the concatenated file (change fps without re-encoding).
Digging deep into that I fixed almost all the problems with timestamps using video_track_timescale:
Code:ffmpeg -y -f concat -safe 0 -i file_list.txt -c copy -video_track_timescale 60 out.mp4 frame= 431 fps=0.0 q=-0.0 Lsize=N/A time=00:00:07.20 bitrate=N/A speed=10.6x video:226kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown [Parsed_vfrdet_0 @ 00000267b58ab100] VFR:0.004651 (2/428) min: 1 max: 2 avg: 1 Stream #0:0(und): Video: hevc (Rext) (hev1 / 0x31766568), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4232 kb/s, 59.86 fps, 60 tbr, 60 tbn, 60 tbc (default)
When I set video_track_timescale 15360 (input clip value) I have 30-40 wrong timestamps.
Finally the problem is:
I have one file with wrong timestamps and wrong fps.
I need to rearrange the timestamps to constant frame rate without reencoding.
if anybody knows how to do that (preferably using ffmpeg) please tell.
@poisondeathray
1. How can I make mp4fpsmod work even when the video file was already opened? When I try to run it on Windows and the video file is open in mpc-hc I see the error:
Code:Reading MP4 stream... libmp4v2: mp4v2::impl::MP4File::Open: open(C:\video.mp4) failed (..\..\mp4v2\src\mp4file.cpp,371)
Last edited by qo4on; 1st May 2020 at 01:52.
Similar Threads
-
changing ffmpeg framerate with " -r " not recognized?
By pxstein in forum Video ConversionReplies: 1Last Post: 21st Apr 2020, 07:23 -
lossless framerate change with ffmpeg?
By BabaG in forum Video ConversionReplies: 7Last Post: 8th Feb 2020, 19:53 -
[FFMPEG] How to merge flac and image to mkv (Wrong Color)
By Anonymous20 in forum Video ConversionReplies: 2Last Post: 7th Feb 2019, 09:34 -
FFMpeg reports wrong video size ?
By alexander121 in forum Video ConversionReplies: 3Last Post: 13th Oct 2017, 10:03 -
FFMPEG change the framerate but keep the same duration
By marcorocchini in forum Newbie / General discussionsReplies: 3Last Post: 19th Mar 2016, 14:27