To put this plainly,
-t don't work very well or even consistently.
I'm trying to take a single input file1 and only encode from a certain start point,
-ss, and for only a certain time,
-t. I've checked and double checked my in times are what I want, down to the frame (calculated to milliseconds2), but ffmpeg adds anywhere from 10 to 19 frames to the beginning, which is more than a half a second. I need frame precise cuts at the in points. Out points can be off by a few if necessary.
I've run the following commands all with exactly the same results on 13 different files. All add the 10 to 19 frames to the beginning.
ffmpeg -ss 00:00:34.600 -t 00:26:40.400 -i 002.m2t [commands] 01.mp4 ffmpeg -i 002.m2t -ss 00:00:34.600 -t 00:26:40.400 [commands] 01.mp4 ffmpeg -ss 00:00:34.600 -i 002.m2t -t 00:26:40.400 [commands] 01.mp4
The [commands] section is exactly
-filter_complex "scale=852:480,setsar=1","eq=brightness=0.05:saturation=1.0" -crf 24 -c:a aac -b:a 64k -ac 1 -loglevel quiet -stats -movflags +faststart
I find many with the same issue, but no solutions. I thought at first that putting
-i would work, but as you can see I've tried moving them around and get exactly the same results.
Is there really no way to cut a video with frame precision in ffmpeg?
In the documentation I found
-seek_timestamp which says
This option enables or disables seeking by timestamp in input files with the -ss option. It is disabled by default. If enabled, the argument to the -ss option is considered an actual timestamp, and is not offset by the start time of the file. This matters only for files which do not start from timestamp 0, such as transport streams.
I know m2t (see footnote 1) is a transport stream, so I tried using
-seek_timestamp, but I get errors that seem to be about parsing the arguments. I've tried putting it in different places in the command too. Maybe the answer is here, but I'm having trouble with the syntax.
The input files are MT2 HDV recorded via firewire from an old Sony cam direct to Vegas Pro.
I import the files to Vegas Pro and trim them on the timeline like any other edit job, but instead of rendering in Vegas Pro, I export the events to eventually derive the ffmpeg commands, with
-teffectively pulled directly from the Vegas Pro timeline. When I do this, the
-ss 00:00:34.600in the command above actually came from the Vegas Pro events like this:
00:00:34;18. The 18 at the end is 18 frames. Since this is 30 fps footage, I calculate the milliseconds needed for the ffmpeg command by dividing by 30.
18/30 = .6.