VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. Hello,

    I am looking for a tool to split a big batch of videos in 2. Basically, I have thousands of videos of 1sec, and I need to split these in 2 equal parts (0,5 each basically.) in bulk. What would be the best solution in your opinon? I've search for a solution with ffmpeg, but no luck so far.
    Quote Quote  
  2. Do your videos use an intra-frame codec or inter-frame? If intra-frame you don't need to reencode. If inter-frame you will have to reencode. Either way you can use ffmpeg with -ss (start) and -t (length) switches.

    For example with intra-frame AVI put this in a batch file to split all AVI files in a folder:

    Code:
    for %%F in (*.avi) do (
        ffmpeg.exe -i "%%F" -c copy -t 0.5 "%%~dpnF.part1.avi"
        ffmpeg.exe -i "%%F" -c copy -ss 0.5 "%%~dpnF.part2.avi"
    )
    The first ffmpeg command line copies the first 0.5 seconds of frames from source.avi to source.part1.avi. The second copies from 0.5 seconds to the end creating source.part2.avi.
    Last edited by jagabo; 4th Dec 2019 at 11:03.
    Quote Quote  
  3. That's a good idea. However it doesn't seem to work.
    If I set %%F, I get "%%F: No such file or directory"
    If I set a file name as if I wanted to process these individually, the first part is done successfully it seems, but not the 2nd one. For that lost one, the file weight 2ko.

    Also, and this is the first it happened to me with ffmpeg. After processing, the windows icons turn blank. I had to restart the PC to fix it.

    (The length of the original video is 1 sec)
    Quote Quote  
  4. I tested the batch file before posting -- it worked perfectly here (Win 7, 64 bit):

    Image
    [Attachment 51021 - Click to enlarge]


    Before running the batch file there were only batch.bat, ffv1.avi, and huff.avi. The two videos contained numbered frames (0 to 23, 23.976 fps). The output files contained frames 0 to 11, and 12 to 23.

    Just to be sure, I copy and pasted the text from my post into a new batch file. It worked fine too.

    Note that the batch file is for intra-frame AVI files (I used huffyuv and ffv1 codecs in the test). And the batch file should be in the same folder as the AVI files. I tested with filenames with and without spaces.

    Upload a few of your video files and I'll test them.
    Quote Quote  
  5. If you want to type in the commands manually to split one file:

    Code:
    ffmpeg.exe -i "input.avi" -c copy -t 0.5 "output1.avi"
    ffmpeg.exe -i "input.avi" -c copy -ss 0.5 "output2.avi"
    Quote Quote  
  6. Hey, it works now. I just tried with a different computer.

    I precise that both computer are Win 10, 64bits

    Thank you jagabo!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!