LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-10-2014, 06:08 PM   #1
donjelek
LQ Newbie
 
Registered: Jan 2014
Posts: 1

Rep: Reputation: Disabled
mencoder convert script


Can please someone help me? . I've got a big list of .rmvb files and i want to convert these files to .avi

I found this command and it works very good:

mencoder <input_movie> -oac mp3lame -ovc lavc -o output_movie.avi

But, i can only use this command for 1 .rmvb file

Does anyone has an idea or example for me to make an (bash? or something else) script to convert the whole list of .rmvb files to .avi files?
And that the script put the converted .avi files in a other directory.

Ive tried to search with several keywords for an example, but no result. ( maby wrong keywords? hahah )
 
Old 01-10-2014, 06:27 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,355

Rep: Reputation: 1989Reputation: 1989Reputation: 1989Reputation: 1989Reputation: 1989Reputation: 1989Reputation: 1989Reputation: 1989Reputation: 1989Reputation: 1989Reputation: 1989
A simple for loop on the command line:
Code:
for i in *.rmvb; do mencoder "$i" -oac mp3lame -ovc lavc -o "/some/other/directory/${i/.rmvb/.avi}"; done
Or if you want a script that can take the files as arguments:
Code:
#!/bin/bash

for i in "$@"; do
   mencoder "$i" -oac mp3lame -ovc lavc -o "/some/other/directory/${i/.rmvb/.avi}"
done

Last edited by suicidaleggroll; 01-10-2014 at 06:30 PM.
 
Old 01-10-2014, 06:33 PM   #3
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
Try this:

Code:
#!/bin/sh

outputdir="output"

mkdir "$outputdir" || exit 1

for i in *.rmvb
do
	mencoder "$i" -oac mp3lame -ovc lavc -o "$outputdir/$(basename "$i" .rmvb).avi"
done

exit 0
If you set outputdir to "$1" then it will take the output directory name from the command line. If you really do have a list of files then you can use 'while read line' to parse it instead of the for loop.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Using Mencoder or Avidemux to convert to xvid Steve W Linux - Software 2 10-23-2013 07:17 AM
[SOLVED] mencoder convert vc-1 Steve W Linux - Software 3 06-29-2011 10:46 AM
does mencoder allows me to convert avi to mp4? sirpelidor Linux - Software 1 12-16-2006 09:34 PM
mencoder to convert 16:9 -> 4:3 letterbox MikeyCarter Linux - Software 1 12-07-2006 05:32 PM
using mencoder to convert directory to avi ogross74 Linux - Software 2 07-05-2005 10:04 AM


All times are GMT -5. The time now is 07:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration