VideoHelp Forum
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. I have pack of .avi files that needs to be trimmed by 5 last seconds. I'm doing it using batch processing and naturally, they all have different length so I can't set a trim from the beginning.
    I know FFMpeg has commands -t and -ss as well as Mencoder has -endpos and -ss, but in my case I don't know if I can use them this way. My .bat file will look like this

    FOR %%i IN (*.avi) DO (
    ffmpeg/mencoder -options "%%i" "%%~ni"1.avi )

    Thanks in advance.
    Quote Quote  
  2. Member bat999's Avatar
    Join Date: Feb 2008
    Location: United Kingdom
    Search Comp PM
    Originally Posted by get8p View Post
    ... they all have different length so I can't set a trim from the beginning.
    I know FFMpeg has commands -t and -ss as well as Mencoder has -endpos and -ss ...
    Hi
    You need to find the duration of each file then subtract 5 seconds and use the result with "-t" or "-endpos" with FFmpeg or MEncoder.


    Code:
    ffprobe "filename"
    shows (for example):-
    Duration: 00:01:02.08
    With mplayer it's a bit more complicated...
    Code:
    mplayer -vo null -ao null -frames 0 -identify "filename" 2>/dev/null | sed -ne '/^ID_/ {s/[]()|&;<>`'"'"'\\!$" []/\\&/g;p}'
    shows (for example):-
    ID_LENGTH=62.08
    Also mediainfo:-
    Code:
    mediainfo "filename"
    shows (for example):-
    Duration : 1mn 0s
    So your .bat file could include a routine to calculate the result and assign it to a variable to be used with "-t" or "-endpos" in the FFmpeg or MEncoder command.
    Last edited by bat999; 2nd Sep 2012 at 13:42.
    Quote Quote  
  3. Ok, but how the final script should look like?
    I don't understand how it should be done.
    Quote Quote  



Similar Threads