LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 11-28-2006, 02:45 PM   #1
rudlavibizon
LQ Newbie
 
Registered: Apr 2006
Posts: 10

Rep: Reputation: 0
Batch converting video files


I would like to convert multiple video files using mencoder but i don't know which command to use. Is there an universal unix command that i can use to execute a program on multiple files?
I'm a newbie to linux and just started to learn the basic shell commands.
 
Old 11-28-2006, 03:53 PM   #2
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
You could use a for loop. Example:

Code:
$ ls -l
total 16
-rw-rw-r--  1 userbob userbob 0 Nov 28 14:43 file1
-rw-rw-r--  1 userbob userbob 0 Nov 28 14:43 file2
-rw-rw-r--  1 userbob userbob 0 Nov 28 14:43 file3
-rw-rw-r--  1 userbob userbob 0 Nov 28 14:43 file4
$
$
$ for i in file[1-4]; do mv $i "${i}.txt"; done
$
$
$ ls -l
total 16
-rw-rw-r--  1 userbob userbob  0 Nov 28 14:43 file1.txt
-rw-rw-r--  1 userbob userbob  0 Nov 28 14:43 file2.txt
-rw-rw-r--  1 userbob userbob  0 Nov 28 14:43 file3.txt
-rw-rw-r--  1 userbob userbob  0 Nov 28 14:43 file4.txt
$
Of course you would have to edit this to apply your conversion command.

Hope this helps.
Fordeck

Last edited by fordeck; 11-28-2006 at 03:55 PM.
 
Old 11-29-2006, 04:32 AM   #3
rudlavibizon
LQ Newbie
 
Registered: Apr 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks for replying. I'll have to get more deeply into the matter. I've found some tutorials about shell scripting on the web . The problem i encountered is that mencoder asks for -o output option and that complicates the whole thing. I've not done any programming since high school (we were thought BASIC) and it will take me some time. Oh well...
 
Old 11-29-2006, 07:22 AM   #4
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Actually you wouldn't have to script this, in the above example it was entered on the command line as shown.

I've not used mencoder, however if you post the syntax you're using to do single file I'll try to send you a small script that will do the job.
 
Old 11-30-2006, 10:16 AM   #5
rudlavibizon
LQ Newbie
 
Registered: Apr 2006
Posts: 10

Original Poster
Rep: Reputation: 0
here is an example:

Code:
mencoder [input-file] -ovc copy -oac pcm -o [output-file]
 
Old 11-30-2006, 10:39 AM   #6
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Ok, I don't have any files to test this on. But this one liner is meant to be entered in a terminal at the prompt. It assumes that you are converting <filename>.wmv files in the current directory to <filename>.pcm files, again in the current directory. If that was your intention you could simply cut the following line and paste it at the command prompt.

Code:
for i in *wmv; do mencoder $i -ovc copy -oac pcm -o "${i}.pcm"; done
Let me know if this is what you're after?

Regards,

Fordeck
 
Old 12-01-2006, 04:25 AM   #7
rudlavibizon
LQ Newbie
 
Registered: Apr 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Not exactly but i get the picture. Actually i was converting audio to pcm and just copying video (-ovc and -oac are options for video and audio codec) because mjpeg avi files from my camera have noisy audio playback in linux. So I did this:

Code:
for i in *AVI; do mencoder $i -ovc copy -oac pcm -o "pcm_${i}"; done
It was a success.

Many thanks

R.B.
 
  


Reply



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
Converting Video files? Snump Mandriva 5 04-11-2007 06:41 PM
LXer: Moving to OpenOffice: Batch Converting Legacy Documents LXer Syndicated Linux News 0 01-12-2006 01:16 AM
Urgent!! Image batch converting, how? hottdogg Linux - General 1 09-26-2005 07:22 AM
Batch convert video files KimVette Linux - General 1 08-02-2005 09:13 PM
Batch converting images ObsessiveMathsFreak Linux - Software 6 06-10-2005 11:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 01:12 AM.

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
Open Source Consulting | Domain Registration