Hello All,
I have a number of 1-2 hour AVI files which I would like to segment. The content is NTSC, 29.97. It is compressed as YUY2, 720x480. I use lossless video compression "UtVideo YUV422 BT.601 VCM".
For each file, I have identified a list of intervals that I would like to keep, i.e., [f_1,f_2], [f_3, f_4], ..., [f_(n-1), f_n], where each f_i is a frame number. The intervals are overlapping but are not necessarily contiguous (there is some content that I don't need).
I would like to create a separate file for each one of the segments. I know how to do it one at a time using VirtualDub but it is very time consuming since I have many scenes oer take I would like to segment. What is the best way to accomplish this?
Thanks
crbd98
+ Reply to Thread
Results 1 to 7 of 7
-
-
If you know a bit about programming/scripting you could:
a. read up on Virtual Dubs Scripting language
b. write a program/script in another script that creates a script for Virtual Dub based on your list of frame intervals
c. progress the Virtual Dub script
One could also write a script which uses ffmpeg to split the file.
You could also check if "Cut Assistant", "Lossless-cut" or a similar tools support importing a cut list and then convert your frame list into such a cut list.
Cu Selurusers currently on my ignore list: deadrats, Stears555, marcorocchini -
Here's a batch file that uses ffmpeg to trim by frame numbers:
Code:@echo off SET /P start=Enter starting frame number: SET /P end=Enter ending frame number: set/A startms=%start%*1001/30 set/A endms=(%end%+1)*1001/30 ffmpeg.exe -y -i "%~dpnx1" -ss %startms%ms -to %endms%ms -c copy "%~dpn1 (%start%-%end%).avi" pause
If you put the batch file in your "Send To" folder you can right click on a video and select Send To -> Batchname, where Batchname is the name of the batch file.
Note that, as written, the batch file assumes 29.97 fps (30000/1001). You will need to change it for other frame rates. For example, for 25 fps you would change to "set/A startms=%start%*1000/25", and the same for endms.
If ffmpeg isn't in your search path you will need to specify the entire path to ffmpeg.exe. For example: "C:\Program Files\ffmpeg\bin\ffmpeg.exe", rather than just "ffmpeg".
I tried a dozen or so different trims and they were all accurate. But they might occasionally be off by 1 frame at the start or end (due to rounding errors in the conversion from frame numbers to milliseconds in the batch file and milliseconds to frame numbers within ffmpeg).Last edited by jagabo; 23rd Mar 2021 at 21:09.
-
@Jagabo... What level FFMpeg are you using? When I try your script on a 250 GOP, it freeze frames with image from frame 250, until the next I frame of original at frame 250. I have found this to be the normal action of every FFMpeg version I have used. Am I doing something wrong?
Frame 100 from original:
[Attachment 57986 - Click to enlarge]
Frame 0 from the cut video:
[Attachment 57987 - Click to enlarge]
Frame 250 from original:
[Attachment 57988 - Click to enlarge] -
-
Ahhhh. Very clear explanation as your usual . It
make perfect sense now. Great explanation. Thanks.
Similar Threads
-
How to split a .TS video file based on time (not file size!) ?
By Michael REMY in forum EditingReplies: 4Last Post: 19th Sep 2020, 18:32 -
Adding numbers to output file names with YouTube-DLG
By Hakunamatata67 in forum Video Streaming DownloadingReplies: 6Last Post: 18th Jun 2020, 03:32 -
Find out frame numbers for qp files
By Valit in forum Newbie / General discussionsReplies: 7Last Post: 13th Feb 2020, 12:57 -
Why frame numbers in VirtualDub and Avisynth different?
By Megafox in forum Newbie / General discussionsReplies: 5Last Post: 15th Sep 2018, 11:56 -
Display Optional Frame Numbers?
By jfharper in forum EditingReplies: 3Last Post: 8th Feb 2017, 23:38