VideoHelp Forum




+ Reply to Thread
Results 1 to 16 of 16
  1. Hi, I have a silly question, maybe you know better about it.

    I downloaded a tv series with many episodes, but it has a very annoying intro, that I want to delete.
    Is there a way to perform the same editing task (in this case cut the first ten seconds) to many videos at once? What program can do that?

    I'm not really a pro, and so far I everything I tried was pretty unsuccessful:

    - I tried a simple program called "Easy video splitter", just to discover it doesn't deal with mp4...
    - I tried another simple program called "Ultra video splitter", just to discover it's so crappy it doesn't even allow to manually write the cut point (it allows only one), nor does it allows to brows a video frame by frame...
    - I then tried a serious program called "Cyberlink power director", but of course it doesn't handle many videos at once and it actually wants to RECODE the video once edited!

    I'm sure smart people know better.
    Thanks
    Quote Quote  
  2. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    This has been asked sooooooo many times now, it's annoying.......

    Get the latest ffmpeg and use this script. (create a subfolder named "trimmed" in your mp4 folder). Make sure to edit path to ffmpeg.

    Code:
    for %%a in ("*.mp4") do "C:\FFmbc\ffmpeg" -i %%a -ss 00:00:10.000 -c:v copy -c:a copy trimmed\%%a
    pause
    This batch file should trim out the first 10 sec and direct stream copy all your mp4's in your folder. It will be very quick.
    Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
    Quote Quote  
  3. Sorry, but I can't make it work. I don't know where I have to specify the path for the videos' folder, but assuming is ("PATH HERE\*.mp4"), it gives me the error message "%%a was unexpected this time".
    Last edited by Ferden; 13th Sep 2014 at 12:18.
    Quote Quote  
  4. Of course, if you did it one at a time you would be done by now. Or you could just grin and bear it for 10 seconds and watch your show.
    Quote Quote  
  5. Originally Posted by Ferden View Post
    Sorry, but I can't make it work. I don't know where I have to specify the path for the videos' folder, but assuming is ("PATH HERE\*.mp4"), it gives me the error message "%%a was unexpected this time".
    Did you enter the command directly at the cmd line, or did you put the line in a bat file? Direct from the command line use a single % - from a bat file use double %%.
    They that give up essential liberty to obtain a little temporary safety deserve neither liberty or safety.
    --Benjamin Franklin
    Quote Quote  
  6. You put that mentioned line into notepad and save it as whatever_name.BAT file.
    Make sure that path to ffmpeg.exe in that batch file is correct, you have to download it first from the web (just to be sure).
    Then you always place that something.BAT into same directory as your videos. Then you run that whatever_name.BAT.
    Quote Quote  
  7. Originally Posted by drjtech View Post
    Did you enter the command directly at the cmd line, or did you put the line in a bat file? Direct from the command line use a single % - from a bat file use double %%.
    Ok, now it's getting scary... I'd like to start by explaining I don't know what "cmd line" or "bat file" are, but let's pretend I do. This is what I did:



    - As anybody with a sound mind, I double clicked the first file I saw in the folder racer-x told me to download. That gives me a black window with some geeky gibberish.

    - I copy pasted racer-x's framed gibberish and pressed enter. Result: "press any key to continue" and nothing more

    - I modified the sentence in order to have the word "pause" in the same line, not in the next line as this forum displays it and my clipboard memory interpreted. Result: "%%a was unexpected this time" and nothing good

    - I played it smart, and I specified the wright path for the program's folder, the wright path for the videos, and I create this "trimmed" subdirectory without even questioning if "trimmed" is a nice name or if I prefer a different one. Result: "%%a was unexpected this time" and nothing good

    - After consulting your post, I followed your advice and deleted one "%" from every "%%a". Result: a series of '"C:\Fff\ffmpeg"' is not recognized as an internal or external command, operable program or batch file. intimidating warnings. Of course C:\Fff is the program's folder path in my pc.

    - I then thought that even the program's path suggested by racer-x could have been wrong, and in fact it is, so I replaced "C:\Fff\ffmpeg" with "C:\FFf\bin\ffmpeg". Result: I finally started to see some kind of interest/reactions from the program's side but of course the wrong ones, like a series of hostiles red lines saying PATH\FIRST WORD OF EACH FILE'S TITLE WHICH I DIDN'T SPECIFY BUT THE PROGRAM ACTUALLY READ ON MY HARD DISK: No such file or directory. Which is particularly insulting, 'cause it means the program did saw the files, but still whined for attention.

    - I then shortened the videos' names, hoping a pc with 32Gb of ram could handle 20 characters at a time instead of 40. Result: the same.

    - I then did something I still have problems justifying myself: I replaced every single space in the every single videos' titles with a "_", you know, like in DOS times. I want to reassure, there's a thing called "Bulk Rename Utility" that wan actually do that... if you only had the same for videos. Result: a series of page-long chinese followed by red warnings claiming trimmed\PATH\NAME.mp4: Invalid argument. So now the program considers wise to put the sub-directory trimmed before the parent directory, and to complain with me about it.

    - I tried to mess with the string and replace trimmed\%a pause with %a\trimmed pause, PATH\trimmed pause, trimmed pause, \trimmed pause, WHATEVER pause... to no avail.



    So I turn again to you, wise, nerdy, command-line savvy folks... what string would make my computer happy?
    Quote Quote  
  8. Originally Posted by _Al_ View Post
    You put that mentioned line into notepad and save it as whatever_name.BAT file.
    Make sure that path to ffmpeg.exe in that batch file is correct, you have to download it first from the web (just to be sure).
    Then you always place that something.BAT into same directory as your videos. Then you run that whatever_name.BAT.
    Hi _Al_, apparently you posted while I was typing an answer to the previous guy. I did what you suggested:

    - Downloaded the program
    - Copied the string
    - Pasted it into a text file
    - Aligned the string in one line instead of two
    - Left it with %%a intacts
    - Specified the videos' directory
    - Corrected "C:\FFmbc\ffmpeg" with "C:\FFmbc\bin\ffmpeg"
    - Saved the text file in the videos' directory
    - Changed the txt extension into bat.
    - Created a sub-directory called trimmed in the videos' folder
    - Changed the videos' names into DOS friendly ones.
    - Run the bat

    It doesn't work. I have a windows that opens, shows very fast red error messages like those I described in the previous post, and then closes. No new files are created in the trimmed sub-directory.
    Quote Quote  
  9. Post the batch file text verbatim

    Add "pause" at the end to of the batch files see the error messages



    What type of files are you trying to process? MP4? MKV ? various ?

    Did you have other streams you want to keep ? or just 1 video, 1 audio (e.g. maybe subtitle stream) ?
    Quote Quote  
  10. Keep everything in the same folder for now, just to keep it simple.

    Put the batch file, and ffmpeg.exe into the same folder as the videos (or you can specify a path or environment variable, or output destination folder, but just keep everything simple for now)

    Use quotation marks, in case your filenames have gaps/spaces

    Code:
    for %%a in ("*.mp4") do ffmpeg -i "%%a" -ss 00:00:10 -c:v copy -c:a copy "%%~na.new.mp4"
    pause
    Quote Quote  
  11. Originally Posted by poisondeathray View Post
    Post the batch file text verbatim
    Ok, here two of the many versions I tried:

    Code:
    for %%a in ("G:\Second\*.mp4") do "G:\Second\FFmbc\bin\ffmpeg" -i %%a -ss 00:00:10.000 -c:v copy -c:a copy trimmed\%%a pause
    Code:
    for %%a in ("G:\Second\*.mp4") do "G:\Second\FFmbc\bin\ffmpeg" -i %%a -ss 00:00:10.000 -c:v copy -c:a copy "%%~na.new.mp4" pause
    This after I moved the program to the videos' folder. I tried many variations, like 00:00:10 instead of 00:00:10.000, %%~new.mp4 instead of %%~na.new.mp4, and the like...
    I see a difference, though: with the trimmed sub-directory option the program does nothing, with the second version it creates the expected files but they are all o bytes big.



    Originally Posted by poisondeathray View Post
    Add "pause" at the end to of the batch files see the error messages
    Nope, the window closes regardless, it stays open only when I use the cmd line.



    Originally Posted by poisondeathray View Post
    What type of files are you trying to process? MP4? MKV ? various ?
    Many mp4 and one avi, but I tried to move the avi away, and anyway the program recognizes, or at least finds, every mp4 in the folder. I made the mp4 myself from a set of dvds and Dvd fab. They all work.



    Originally Posted by poisondeathray View Post
    Did you have other streams you want to keep ? or just 1 video, 1 audio (e.g. maybe subtitle stream) ?
    Each file has one video and one audio.



    Originally Posted by poisondeathray View Post
    Keep everything in the same folder for now, just to keep it simple.

    Put the batch file, and ffmpeg.exe into the same folder as the videos (or you can specify a path or environment variable, or output destination folder, but just keep everything simple for now)
    I tried the program's folder on c:\, on the videos' folder, and also the ffmpeg.exe itself on the videos' folder, (with the string changed accordingly), but nothing. I even tried both the 32bit and 64bit versions.



    Originally Posted by poisondeathray View Post
    Use quotation marks, in case your filenames have gaps/spaces
    Nope, I always used quotations marks

    Code:
    "
    in the string (as shown in the original racer-x suggested) but the program never recognize files with spaces.
    Quote Quote  
  12. The problem is you didn't copy & paste or follow instructions

    The 2nd one will work , if you remove the G:\second from the wildcard , and place ffmpeg in the root directory

    Follow the instrucitons in post #10 again





    And is your ffmpeg binary really in the ffmbc folder ? (ffmpeg and ffmbc are related but different)

    For the 1st one, if you use output paths, use full paths for "trimmed"

    e.g. if you wanted to specify paths, but still use the .bat file in G:\Second

    Code:
    for %%a in ("*.mp4") do "G:\Second\FFmbc\bin\ffmpeg\ffmpeg.exe" -i "%%a" -ss 00:00:10 -c:v copy -c:a copy "G:\Second\trimmed\%%~na.new.mp4"
    pause
    Quote Quote  
  13. Originally Posted by poisondeathray View Post
    The problem is you didn't copy & paste or follow instructions

    The 2nd one will work , if you remove the G:\second from the wildcard , and place ffmpeg in the root directory

    Follow the instrucitons in post #10 again
    I actually did that already:

    Originally Posted by Ferden View Post
    I tried the program's folder on c:\, on the videos' folder, and also the ffmpeg.exe itself on the videos' folder, (with the string changed accordingly), but nothing.
    whose result was:

    Originally Posted by Ferden View Post
    it creates the expected files but they are all 0 bytes big.


    Originally Posted by poisondeathray View Post
    And is your ffmpeg binary really in the ffmbc folder ? (ffmpeg and ffmbc are related but different)
    Yes, it is, but not in the place your last string put it:

    Code:
    "...\FFmbc\bin\ffmpeg\ffmpeg.exe"
    nor in the place racer-x pointed at:

    Code:
    "...\FFmbc\ffmpeg\ffmpeg.exe"
    it's instead in:

    Code:
    "...\FFmbc\bin\ffmpeg.exe"
    (that's the default place in the distribution)



    What finally worked it's your last code (with the correct program path):

    Originally Posted by poisondeathray View Post
    Code:
    for %%a in ("*.mp4") do "G:\Second\FFmbc\bin\ffmpeg.exe" -i "%%a" -ss 00:00:10 -c:v copy -c:a copy "G:\Second\trimmed\%%~na.new.mp4"
    pause
    Apparently what made the difference was specifying in full lenght the destination folder: trimmed\%%a or "%%~na.new.mp4" were not accepted.
    Another question... can you modify the string in order to order the editing to all mp4 and all avi in the folder at once?
    Last edited by Ferden; 15th Sep 2014 at 01:30.
    Quote Quote  
  14. Originally Posted by Ferden View Post
    Another question... can you modify the string in order to order the editing to all mp4 and all avi in the folder at once?
    Sure, easiest way is just add another command with *.avi instead to the batch


    Code:
    for %%a in ("*.mp4") do "G:\Second\FFmbc\bin\ffmpeg.exe" -i "%%a" -ss 00:00:10 -c:v copy -c:a copy "G:\Second\trimmed\%%~na.new.mp4"
    
    for %%a in ("*.avi") do "G:\Second\FFmbc\bin\ffmpeg.exe" -i "%%a" -ss 00:00:10 -c:v copy -c:a copy "G:\Second\trimmed\%%~na.new.avi"
    
    pause
    Quote Quote  
  15. Member
    Join Date
    Oct 2009
    Location
    United States
    Search Comp PM
    Ferden...... if you are working with mp4 files and you want something really easy to use for trimming your video files then I recommend VideoRedo TV suite. It will cost you some $$ but to me it is well worth it.

    VRD is super simple to use. They have a trial version you can download to see if you will like it.

    If you do purchase the full version, this software has a batch edit feature which allows you to edit multiple different files.

    TC
    My Dell PC system info.....3.4 Ghz Quad Core i7 processor....... 12 gigs of ram DDR3...... Windows 7 ultimate 64 bit.......video card Nvidia GTX 650
    Quote Quote  
  16. Well, thank you all for the advise
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!