1
I am currently trying to take a video file and split it into pieces that can then be encoded and pieced back together later. As a test I am trying to split a video into two pieces and then stitching them back together.
This is the code i used for the first video piece...
ffmpeg -i Video.mp4 -codec copy -frames:v 660 -an Output1.mp4
Never mind the 660 frames and no audio. The 660 is just so it would be easier to tell if the files stitched back together properly.This part isn't the problem.
Here is the code for the second piece...
ffmpeg -i Video -filter_complex:v "select=gte(n\, 660) [tmp]; [tmp] setpts=PTS-STARTPTS" -an -frames:v 2000 Output2.mp4
Again, here the number of frames and no audio doesn't matter. The setpts filter is so that the individual video file doesn't sit for about 20 seconds waiting for the first frame's timestamp to appear. I have also tried this without the setpts filter and it works fine except for the fact that it has a very long pause before the frames start. This part isn't the problem either...I don't think
Finally, here is the code for when I try to reattach the files to each other...
ffmpeg -f concat -i list.txt Output3.mp4
Here is the list.txt file...
file 'Output1.mp4'
file 'Output2.mp4'
All of the files work fine until this point when ffmpeg tries to concatenate them onto each other. The first file goes through fine but when trying to attach the second file ffmpeg drops nearly 1900 of the 2000 frames...
frame= .... fps= .... q= .... Lsize= .... time= .... bitrate= ....
dup= 0 drop= 1900
(The 1900 varies but it is always around that amount)
Also, the Output3.mp4 video file is always 29 seconds not matter what I do to the concatenating code or the second video file's.
Please help I cannot find a solution anywhere online and the documentation for this stuff is extremely limited. Also, it would be great if someone could explain exactly what is going on during the video file splitting, specifically the second video file's. I would also be open to any other software suggestions if someone knows a software that would do these tasks or at least the video splitting part. Thanks a lot.
1Paste the full console outputs for all 3 commands. – Gyan – 2016-01-03T06:03:20.000