LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 08-11-2011, 09:26 PM   #1
lonesoac0
Member
 
Registered: Jan 2010
Distribution: Ubuntu
Posts: 89

Rep: Reputation: 4
Cool variable file input


hello all,

I have an issue with the command of:
Code:
mencoder -vf rotate=1 -o output.avi -oac pcm -ovc lavc *.MOV
It encodes from MOVs to AVIs just fine, but I can only do one at a time since output.avi is the only file name that my command knows to output to. I would like the capability to encode MOVs to AVIs in mass with one command.

Any ideas?
 
Old 08-12-2011, 03:19 AM   #2
tommyttt
Member
 
Registered: Oct 2009
Location: Federal Way, WA
Distribution: openSUSE 11.4 x86_64, openSuSE 12.1, Fedora 15
Posts: 207

Rep: Reputation: 34
Quote:
Originally Posted by lonesoac0 View Post
hello all,

I have an issue with the command of:
Code:
mencoder -vf rotate=1 -o output.avi -oac pcm -ovc lavc *.MOV
It encodes from MOVs to AVIs just fine, but I can only do one at a time since output.avi is the only file name that my command knows to output to. I would like the capability to encode MOVs to AVIs in mass with one command.

Any ideas?
The only way to change the output filename of a hard-wired program is to get the source code and modify it. Not very practical for non-programmers. However, you could write a bash script (or python or perl) that would call mencoder for each filename and rename the output file to the original name with an avi extension (beyond my limited ability so ask about it in another thread here).

Tom
 
Old 08-12-2011, 10:25 AM   #3
lonesoac0
Member
 
Registered: Jan 2010
Distribution: Ubuntu
Posts: 89

Original Poster
Rep: Reputation: 4
A Bash script would be fine for me.
 
Old 08-13-2011, 12:53 AM   #4
lonesoac0
Member
 
Registered: Jan 2010
Distribution: Ubuntu
Posts: 89

Original Poster
Rep: Reputation: 4
Yo! I figured out what I wanted to do...it is some NASTY code though.

*********************
#!/bin/bash
for var in *
do mencoder -vf rotate=1 -o "$var.avi" -oac pcm -ovc lavc "$var"
done
*********************

I start with two files of IMG_0001.MOV and IMG_0002.MOV and end up with IMG_0001.MOV.avi, IMG_0001.MOV, IMG_0002.MOV.avi, IMG_0002.MOV

if anyone has any better code I would like to know!

Last edited by lonesoac0; 08-13-2011 at 12:55 AM. Reason: After though for everyone else....
 
Old 10-02-2011, 02:45 AM   #5
lonesoac0
Member
 
Registered: Jan 2010
Distribution: Ubuntu
Posts: 89

Original Poster
Rep: Reputation: 4
hello all,

i have an update on this command. I finally figured it out.

Code:
#!/bin/bash
cd /DIR/DIR
set=$(ls -1 | grep '.MOV'')
for var in $set; do
        mencoder -vf rotate=1 -o $(echo $var | sed -e 's/.MOV/.avi/g') -oac pcm -ovc lavc "$var"
        rm "$var"
done
Note: That is a ONE and not an L in the ls -1 section!

---------- Post added 10-02-11 at 01:45 AM ----------

hello all,

i have an update on this command. I finally figured it out.

Code:
#!/bin/bash
cd /DIR/DIR
set=$(ls -1 | grep '.MOV'')
for var in $set; do
        mencoder -vf rotate=1 -o $(echo $var | sed -e 's/.MOV/.avi/g') -oac pcm -ovc lavc "$var"
        rm "$var"
done
Note: That is a ONE and not an L in the ls -1 section!
 
  


Reply

Tags
output


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
tail -f as variable input into a script willyjc1 Linux - Newbie 2 06-30-2011 11:35 AM
[SOLVED] How sed can catch variable from input drele Programming 5 02-03-2011 01:50 AM
Bash: Input password into a variable 1veedo Linux - General 5 08-24-2010 04:07 AM
[SOLVED] How to get invalid user input into a variable TheNewVegas Linux - Newbie 9 04-09-2010 03:43 AM
bash - how to take input as a variable? trees Linux - General 1 02-19-2004 05:09 PM


All times are GMT -5. The time now is 11:52 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration