Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Mencoding Mass

  1. #11
    Join Date
    Jun 2007
    Location
    /usr/src
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Mencoding Mass

    Do you need to work recursively through the directory? or just one layer?

  2. #12
    Join Date
    Mar 2005
    Beans
    62

    Re: Mencoding Mass

    just one layer. keep it simple. But I'd like the output directory to be in the same folder as the .avi's

  3. #13
    Join Date
    Oct 2006
    Location
    Tucson, Arizona
    Beans
    1,508

    Re: Mencoding Mass

    if
    Code:
    for i in `ls *.mpg`; do
    mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup \
    -srate 48000 -af lavcresample=48000 \
    -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:aspect=16/9:\
    acodec=ac3:abitrate=192:threads=4 -ofps 30000/1001 -o ${i} ${i%.mpg}.avi;
    done
    as posted above works to do the encoding changed to start with .avi instead of .mpg,
    then for what you want:
    Code:
    #! /bin/sh
    for i in `ls *.avi`; do
    mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup \
    -srate 48000 -af lavcresample=48000 \
    -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:aspect=16/9:\
    acodec=ac3:abitrate=192:threads=4 -ofps 30000/1001 -o ${i} ${i%}.mpg;
    done
    mkdir output
    mv *.mpg output
    (not sure this is 100% correct, but you should be able to make a file allong these lines executable and run it in a directory to convert the files and move them.)

  4. #14
    Join Date
    Mar 2005
    Beans
    62

    Re: Mencoding Mass

    BINGO! Thank you very much Sir .

    That is exactly what I wanted. I knew the script would be simple, I've just not had enough time to re-learn my bash scripting. Something I'll have to brush up on very soon.

  5. #15
    Join Date
    Jun 2007
    Location
    /usr/src
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Mencoding Mass

    in bash you could do something like:

    Code:
    #!/usr/bin/env bash
    
    echo starting....
    
    for f in ./*.avi; do
    
    mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup \
    -srate 48000 -af lavcresample=48000 \
    -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:aspect=16/9:\
    acodec=ac3:abitrate=192:threads=4 -ofps 30000/1001 -o $f.mpg $f.avi ;
    done;
    
    echo finished...
    Of course, you would need to strip the file extension off the file name, and maybe debug a bit, but it should work fine.

  6. #16
    Join Date
    Jun 2007
    Location
    /usr/src
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Mencoding Mass

    Ah, beaten to the punch!

  7. #17
    Join Date
    Sep 2006
    Beans
    2,914

    Re: Mencoding Mass

    Quote Originally Posted by hod139 View Post
    Note, this is untested and might break if files have spaces.
    Code:
    for i in `ls *.mpg`;
    the above is what people call useless use of ls. use shell expansion instead
    Code:
    for i in *.mpg

  8. #18
    Join Date
    Dec 2005
    Location
    Kurdistan
    Beans
    632
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Mencoding Mass

    hey these scripts work fine for file names without space !
    but they dont work for file names with spaces,
    for example
    it wont work for "Scrubs S03E03 My White Whale [FuFu].avi"

    is there any way to make it work for file names with space ?

  9. #19
    Join Date
    Dec 2005
    Location
    Kurdistan
    Beans
    632
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Mencoding Mass

    the error message is
    MEncoder 2:1.0~rc2-0ubuntu13+medibuntu1 (C) 2000-2007 MPlayer Team
    CPU: Intel(R) Core(TM)2 Duo CPU E8200 @ 2.66GHz (Family: 6, Model: 23, Stepping: 6)
    CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
    Compiled with runtime CPU detection.
    File not found: '[FuFu].avi'

  10. #20
    Join Date
    Mar 2005
    Beans
    947
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Mencoding Mass

    Quote Originally Posted by medya View Post
    is there any way to make it work for file names with space ?
    Use quote marks, e.g. "$1" instead of $1.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •