LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-11-2008, 03:06 PM   #1
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Rep: Reputation: 15
Piping...


Hi

I want to convert some image files to animation. But I am having trouble piping the stream of files into the conversion command. Now all my files are named 0.png, 1.png 2.png etc etc. However I cannot simply use a *.png command, as this pulls in files in non numerical order. Now I can pull in files in numerical order with

ls | sort -n

However I want to use the commands on

http://www.pymolwiki.org/index.php/Making_Movies
such as

mencoder -mc 0 -noskip -skiplimit 0 -ovc lavc -lavcopts \
vcodec=mpeg4:vhq:trell:mbd=2:vmax_b_frames=1:v4mv:vb_strategy=0:vlelim=0:vcelim=0:cmp=6:subcmp=6re cmp=6redia=3:dia=3:vme=4:vqscale=1 \
mf://*.png -mf type=png:fps=18 -o output.avi

I have no idea how to pipe the output from the ls into the right format such that I can create the image files correctly. How can this be done.

Thanks
 
Old 02-11-2008, 03:49 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Quote:
Originally Posted by disruptive View Post
...
I have no idea how to pipe the output from the ls into the right format such that I can create the image files correctly. How can this be done.
hmm... I can't seem to get that command to run on my machine, but, in theory, you would do what you're trying to do by:

mencoder -mc 0 -noskip -skiplimit 0 -ovc lavc -lavcopts \
vcodec=mpeg4:vhq:trell:mbd=2:vmax_b_frames=1:v4mv:vb_strategy=0:vlelim=0:vcelim=0:cmp=6:subcmp=6:pre cmp=6:predia=3:dia=3:vme=4:vqscale=1 \
mf://`ls | sort -n` -mf type=png:fps=18 -o output.avi

... but I can't test it as, again, I can't run the example at all on my machine.
 
Old 02-12-2008, 03:55 AM   #3
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Original Poster
Rep: Reputation: 15
Aha!

I had already thought of that! However it does not work. The command can be installed under ubuntu. The only way I can now think to do it is to reorder the graphics file like 000000, 000001, 000002 such that I can get them in the right order. Otherwise with the command as it is (without the ls), it just means the frames are out of order. Do you know of a cheap fix, where I can change the filenames such they are ordered explicitly in terms of frame order, 0,1,2,3 etc.

Thanks again.
 
Old 02-12-2008, 01:09 PM   #4
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
hrm. Well, if you want to rename them all as a pre-process, that's simple enough:

Code:
#!/bin/tcsh -f

foreach f ($argv)
    mv -v $f `printf "%05d.%s" $f:r $f:e`
end
run it from within the directory full of files, i.e.:

cd /dir/with/files
/path/to/script *

Last edited by BrianK; 02-12-2008 at 01:10 PM.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with piping mijohnst Linux - General 7 10-21-2005 04:14 PM
Need help with commands and piping basselstine Linux - General 1 10-02-2005 09:43 PM
Piping video out to the TV only. dredgemortle Mandriva 3 07-05-2004 12:48 AM
Piping question OtisLinux Linux - Software 1 02-12-2004 01:38 PM
piping data tearinox Linux - Newbie 9 12-09-2003 01:43 PM


All times are GMT -5. The time now is 06:46 PM.

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