VideoHelp Forum




+ Reply to Thread
Results 1 to 3 of 3
  1. I have made a batch file to convert all clips in a folder into vcd mpeg.
    My problem is the encoded clips have the original extension then the MPG ext.
    IE: 'Clip1.flv' converts into 'Clip1.flv.MPG' can anyone suggest how to alter my batch file to remove the original ext when encoded.

    my batch file:

    for %%f in (*.*) do mencoder.exe "%%f" -o "%%f.MPG" -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf scale=352:240,harddup -srate 44100 -af volnorm=1 -lavcopts vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_m inrate=1152:vbitrate=1152:
    vrc_maxrate=1152:acodec=mp2:abitrate=224:aspect=4/3 -ofps 30000/1001
    Quote Quote  
  2. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Try this

    Code:
    for %%F in (*.*) do mencoder.exe "%%F" -o "%%~dpnF.mpg" [..... rest the same]
    (I didn't test this, I don't use mencoder.)

    Type "for /?" at the command line to see some useful expressions you can use in batch files under Win2k or higher.

    eg:
    In addition, substitution of FOR variable references has been enhanced.
    You can now use the following optional syntax:

    %~I - expands %I removing any surrounding quotes (")
    %~fI - expands %I to a fully qualified path name
    %~dI - expands %I to a drive letter only
    %~pI - expands %I to a path only
    %~nI - expands %I to a file name only
    %~xI - expands %I to a file extension only
    %~sI - expanded path contains short names only
    so %%~dpn gives you (drive letter + path + filename); i.e., omitting extension.

    I wonder if this might get into an infinite loop. Does it keep converting all the new MPG files?
    Maybe the file list is fixed on the first call. Anyway, if you're only doing flv files, why not do
    (*.flv) rather than (*.*), or put the output files into a different directory.
    Quote Quote  
  3. Alan, thanks very much for the info, I have changed -o "%%f.MPG" into
    -o "%%~nf.MPG" and it works perfectly, dropping the original extension.
    (from your post %~nI - expands %I to a file name only )

    The batch does not loop into the mpegs, and has not in the past.
    I use *.* as i convert many different formats at a time.

    Great help thanks Alan.
    Quote Quote  



Similar Threads

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