bash redirection

Craig White craigwhite at azapple.com
Thu Oct 18 20:18:16 MST 2007


On Thu, 2007-10-18 at 20:04 -0700, Kurt Granroth wrote:
> Craig White wrote:
> > I am so weak on shell scripting - and I do try and I wear out the info
> > pages (way too many on bash)...
> > 
> > how do I redirect output to input...
> > 
> > I am trying to pipe output of mplayer into ffmpeg and I can't get my
> > head around it since ffmpeg needs an input file...
> > 
> > ffmpeg -i some_file_somewhere outputfile_somewhere 
> > (or off the X11 display which doesn't seem useful at all.)
> > 
> > ideally, I would like to do something like this...
> > 
> > mplayer dvd://$TITLE -chapter "$X-$X" -dumpstream -dumpfile
> > "$X-$NAME.vob" | \
> > ffmpeg -i "$X-$NAME.vob" -s 360x240 -ab 128 "$X-$NAME.mp4"
> > 
> > but even better, I would love to not write the intermediate.vob file at
> > all.
> > 
> > I just want to rip my music DVD's to my iPod (by the way...the 360x240
> > at 128 bps audio from high quality DVD gives really great quality iPod
> > video/audio for a very small footprint).
> 
> Okay, I'm going to first talk in general and then for your specific case.
> 
> In general, you only use pipe | when you are outputting to stdout and
> passing it as stdin to the next program.  So using a pipe makes no sense
> when you are using an intermediate file as input and output.
> 
> Most utilities that require an input file accept '-' as stdin and quite
> a few accept it as the notation for stdout as well.  So in theory you
> could do something like:
> 
> mplayer dvd:// -o - | ffmpeg -i - myfile.mp4
> 
> In practice, that won't work.  That's because while ffmpeg *does* honor
> the - as stdin, I don't know if mplayer can actually dump to stdout at all.
> 
> That's all for the general case.  In your specific case, I wouldn't
> recommend using mplayer and ffmpeg at all.  Instead, use mencoder.
> mencoder ships with mplayer, usually, and it is designed to transcode
> video streams on the fly.  Here is nearly *exactly* what you want to do:
> 
> http://gentoo-wiki.com/HOWTO_Rip_DVD_mencoder
> 
> And if you want a script that does it all for you:
> 
> http://diveintomark.org/archives/2007/06/07/howto-batch-encode-video-for-ipod-under-linux-2007-edition
----
;-)

gee and I thought I had already done the heavy lifting...

wow, that's a script - thanks for the clue stick and to quote Kenny
Loggins after they played "This Is It" on the Live From the Redwoods
DVD...nailed it.

I did see the reference to mencoder in mplayer man pages but it isn't
installed as part of mplayer packaging on Fedora/Livna but rather is
packaged separately but installed easily enough.

Thanks

Craig



More information about the PLUG-discuss mailing list