OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

3 Pages V  < 1 2 3  
Reply to this topicStart new topic
> Encoding Videos For Zaurus, Improved Bash Script
nilch
post Nov 1 2006, 07:37 AM
Post #31





Group: Members
Posts: 668
Joined: 3-December 03
From: US
Member No.: 1,034



QUOTE(vrejakti @ Jul 10 2006, 11:56 PM)
It's been a while since I posted my first encoding video for the Zaurus script, so here's an updated Version 2 of it. Enjoy. happy.gif

Please post any suggestions for improvements. I'm still learning how to write bash scripts, so there's bound to be room for improvement. happy.gif Version 3 will allow for encoding multiple files.
*


I lost this thread here ... tell me, is this all doable on the Zaurus, or is it just video encoding for the Zaurus on the desktop ?

I would love to have some script which can encode single to 2-3 files on my zaurus which I copy from the internet without knowing if its codecs will be supported by Kino or not.

Having a mass batch encoder like what the thread discusses later on, on the desktop for overnight runs is also a good idea but naturally limited to the desktop.

Sorry guys, not much idea about video encoding hence the incomprehension about basic facts ohmy.gif
Go to the top of the page
 
+Quote Post
vrejakti
post Nov 1 2006, 08:24 AM
Post #32





Group: Members
Posts: 21
Joined: 8-December 05
Member No.: 8,686



You're right about this thread being all over the place. happy.gif To answer your question, I always assumed the encoding would be done on a desktop, mainly because computer resources greatly affect the time to encode a video. It is still possible to encode on the Zaurus, if you have the mencoder package installed.

I have seen a mencoder package for the Zaurus, though I'm sorry I don't have a link.
Go to the top of the page
 
+Quote Post
vrejakti
post Nov 1 2006, 04:02 PM
Post #33





Group: Members
Posts: 21
Joined: 8-December 05
Member No.: 8,686



QUOTE(Da_Blitz @ Nov 1 2006, 06:13 AM)
any particular reason for zsh? i try hard to keep my dependencies down to bash
*

Here's the issue I had when using /bin/bash or /bin/ksh

CODE
debian% ls
[S^M] Galaxy Ange-lune 04 RAW.avi
debian% ./script.sh
File not found: '[S^M]'
Failed to open [S^M].

zsh seems to be the only shell that can properly pass complex file names in variables to mencoder. Personally, I use whatever works. At some point, I may even try doing this same script in perl or C - just for heck of it.

Edit: After thinking about it, you raise a very good point. I assume a lot more people have access to bash than zsh, so I changed my newest release to use #!/bin/bash by default, leaving the end user the option to change it to use #!/bin/zsh if needed for complex file name issues.

I've tried a lot of solutions to file names. From using a long script of sed replacement commands, to saving files to a text file and greping each line, as well as quoting, double quoting, and single quoting. zsh works for now.

Keep up the good work on your script Da_Blitz. I'm looking forward to seeing your next release. I still think the scripts we're working on are very useful. Not many people have the time to read the mplayer man pages to learn how to write a profile for their needs, that's why scripts that simplify or automate the proccess are still useful, I think. happy.gif




Here's my latest script
View script online as text.
Download script.

Notes on features.
Using -e smartcoder tells the script to automagically seek out any video files in the current directory and encode them for Zaurus Playback.

Experimental auto-resolution calculation tries to guess a correct 4:3 resolution for you when scaling the video.

Selecting "op" when asked "Start encoding? [Yes/No/op]" will allow you to encode the first hh:mm:ss of a video. It's good for catching opening themes from anime.
Go to the top of the page
 
+Quote Post
grog
post Nov 1 2006, 06:27 PM
Post #34





Group: Members
Posts: 692
Joined: 27-January 04
From: Canada
Member No.: 1,564



QUOTE(vrejakti @ Nov 1 2006, 06:02 PM)
QUOTE(Da_Blitz @ Nov 1 2006, 06:13 AM)
any particular reason for zsh? i try hard to keep my dependencies down to bash
*

Here's the issue I had when using /bin/bash or /bin/ksh

CODE
debian% ls
[S^M] Galaxy Ange-lune 04 RAW.avi
debian% ./script.sh
File not found: '[S^M]'
Failed to open [S^M].

zsh seems to be the only shell that can properly pass complex file names in variables to mencoder. Personally, I use whatever works. At some point, I may even try doing this same script in perl or C - just for heck of it.

I've tried a lot of solutions to file names. From using a long script of sed replacement commands, to saving files to a text file and greping each line, as well as quoting, double quoting, and single quoting. zsh works for now.
*


You should be able to just quote the variable, for example:

CODE
mencoder "$F"

Admittedly I've never used zsh, but I've yet to find anything that couldn't be accomplished with bash or korn smile.gif. HTH
Go to the top of the page
 
+Quote Post
Da_Blitz
post Nov 1 2006, 06:53 PM
Post #35





Group: Members
Posts: 1,565
Joined: 7-April 05
From: Sydney, Australia
Member No.: 6,806



well the problem that you are getting is related to spaces in the file name, it is wierd that double quoting dosent work (single qoutes dont allow for varible expansion wink.gif)

i would think that
CODE
mencoder "$IN" -ovc lavc -lavcopts debug=0:vcodec=mpeg4:vbitrate=300:vpass=1 -vf scale=$WIDTH:$HEIGHT -oac copy -o $OUT
#--------------------
mencoder "$IN" -ovc lavc -lavcopts debug=0:vcodec=mpeg4:vbitrate=300:vpass=2 -vf scale=$WIDTH:$HEIGHT -oac copy -o $OUT


should become
CODE
mencoder "$IN" -ovc lavc -lavcopts debug=0:vcodec=mpeg4:vbitrate=300:vpass=1 -vf scale=$WIDTH:$HEIGHT -oac copy -o "$OUT"
#--------------------
mencoder "$IN" -ovc lavc -lavcopts debug=0:vcodec=mpeg4:vbitrate=300:vpass=2 -vf scale=$WIDTH:$HEIGHT -oac copy -o "$OUT"


and just magiacally work ($OUT to "$OUT")

anyway back to my ones, perosnally i wanted to have my script done by now so i could focus on coming up with the encoding reipies that work best for the Z, its a shame that i havent gotten to that stage yet

i use Zsh all the time for its contextual auto compleation however there are some features (or bugs) that i dont like so i have been considering making an ncurses shell that is interactive only (ie not for scripting) as i feel bash is more than adequte for that. the advantage of using ncurses is that its easy to extend to dual monitor support (which i have) and helps take care of resizing. instead of the zsh autocemplete with filnames that shifts everything up and leaves it that way when it disappears (anoying when you needed the history) i am thinking of a popup window that slides form the bottom upwards moving the content up as well. when it disappears the content slides down to its originol postion as well

its somthing i am working on as well as a small 100 liner copy and paste deamon (how do you like bieng able to go cat $FILE | copy in one shell and paste | xargs "ls -l" in another wink.gif) or an enviroment deamon that makes sure that any varible you export (ie export PATH) gets automatically synced across all open shell instances instantlly (i used to have problems when i had 10+ xterms open with diffrent states of exported varibles, sucks when trying to cross compile) designed at getting the user firendlyness of the cmd line up to desktop standards smile.gif
Go to the top of the page
 
+Quote Post
vrejakti
post Nov 1 2006, 07:29 PM
Post #36





Group: Members
Posts: 21
Joined: 8-December 05
Member No.: 8,686



It would be nice if quoting was the solution---(rant cut short)

Da_Blitz, grog, your suggestions worked! Thanks! It really was as simple as quoting "$IN". Looks like zsh won't be needed after all. happy.gif

I must have offset the quoting of my variables somewhere in previous scripts causing that type of quoting not to work, but it works as it should now.
Go to the top of the page
 
+Quote Post
Da_Blitz
post Nov 2 2006, 03:29 AM
Post #37





Group: Members
Posts: 1,565
Joined: 7-April 05
From: Sydney, Australia
Member No.: 6,806



it happens, the most common problem is the null argument (smile.gif) where one uses test or [ with a varible and forgets to qoute it, when a vaible gets passed to it it spits out a "wrong number of args" error and quits causing many headaces or when used with strins compares the first and second word because people forget that spaces seperate args

it happens and you learn to qoute all your varibles because it dosent hurt and gets rid of a problem or two

leasons learned the hard way wink.gif funny thing is its probelly a bug in zsh that made it work
Go to the top of the page
 
+Quote Post

3 Pages V  < 1 2 3
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 28th December 2014 - 12:51 PM