ffmpeg -i Videos/big_buck_bunny_1080p_surround.avi -f mpeg -ac 1 -sameq -s 720x480 - | mplayer -
Enjoy.
Showing posts with label pipe. Show all posts
Showing posts with label pipe. Show all posts
16 March, 2013
FFMpeg Piping to Mplayer
Far too often I find myself playing with ffmpeg, trying to transcode a video and evaluating the results. The typical manner of doing this is taking the input file, generating an output file, then playing with the equivalent of mplayer. The need for the temporary output file is primarily motivated because I wasn't aware how to properly pipe the transcoded video to standard output and pipe it to the display utility (e.g. mplayer).
I did however recently figure this out, and decided to post for those of you struggling with the same issue.
The following example takes in the popular open-source video, transcoding to mpeg format and uses only the first audio chanel, using same video quality but resizes to 720x480 and pipes the output to mplayer.
05 October, 2011
ImageMagick -- Send Directly To Display
'til recently I've always manipulated images, stored them to a temporary file, then displayed them to confirm the desired results.
I've recently found that this is an unnecessary step, as the output of any command can be sent directly to the display using the 'win:' command directive.
E.g.
Cheers.
I've recently found that this is an unnecessary step, as the output of any command can be sent directly to the display using the 'win:' command directive.
E.g.
$ convert main/trunk/Media/Photos/Cats/Dempsey/DSCF0002.JPG -resize "100x100^" -gravity center -crop 100x100 win:
Cheers.
30 June, 2009
Power of the Pipe
For quite some time I've it's been a mystery to me why many Unix-flavored toolsuites offer a command line interface supporting inputting or outputting to stdin/stdout respectively.
For example, ffmpeg can utilize stdin in leu of a input file by specifying -; similarly it can utilize stdout in leu of an output file using the same - specifier.
I've recently become aware of how useful this option can be. In particular it allows you to bypass creating unnecessary temporary files.
For example, using ffmpeg you can redirect the output to stdout and into mplayer to review the impacts of varying codecs and video quality specifiers.
Similarly, you can make use of the similar feature with ImageMagick like so:
In each case, redirecting to stdout and piping to a consuming display utility eliminates the need for creating a temporary file.
For example, ffmpeg can utilize stdin in leu of a input file by specifying -; similarly it can utilize stdout in leu of an output file using the same - specifier.
I've recently become aware of how useful this option can be. In particular it allows you to bypass creating unnecessary temporary files.
For example, using ffmpeg you can redirect the output to stdout and into mplayer to review the impacts of varying codecs and video quality specifiers.
$ ffmpeg -i /var/tmp/foo.mpg -f asf - | mplayer -cache 8192 -
Similarly, you can make use of the similar feature with ImageMagick like so:
$ convert Lenna.jpg - | display -
In each case, redirecting to stdout and piping to a consuming display utility eliminates the need for creating a temporary file.
19 September, 2007
Piping to Tcl Script
Ok, maybe I've lived up to my name. I may very well be the fat slow
kid.
I struggled for some time trying to figure out how to pipe input to a Tcl script and immediately ventured off on a quest for opening a pipe (|) file descriptor. In actuality however, since I wanted to pipe input into the tcl script my needs are met by:
so
results in
My quest however also recovered if the input command is fixed:
would surfice.
kid.
I struggled for some time trying to figure out how to pipe input to a Tcl script and immediately ventured off on a quest for opening a pipe (|) file descriptor. In actuality however, since I wanted to pipe input into the tcl script my needs are met by:
#!/usr/bin/tclsh
while { [gets stdin line] >= 0 } {
puts "got '$line'"
}
so
$ ls | ./tclPipe
results in
got 'Desktop'
got 'IM'
got 'ImagingManager.tar.gz'
got 'ISC'
got 'tclPipe'
My quest however also recovered if the input command is fixed:
#!/usr/bin/tclsh
set fp [open "|ls" r]
while { [gets $fp line] >= 0 } {
puts "got $line"
}
would surfice.
Subscribe to:
Posts (Atom)