Hey I am trying to pipe the output of 'convert' function
The line is
convert -geometry 384x \
../../../Flickr/balance/balance_3/balance_399.png \
ppm:- | ./segment 0.5 2000 100 - balance_399_out.ppm
and throwing error.
terminate called after throwing an instance of 'pnm_error'
Aborted (core dumped)
Is there anyway to pipe output of convert to this executable without saving ppm file.
Related
Here is the command i'm trying in windows powershell.
.\dcraw-9.27-ms-64-bit.exe -c "C:\Downloads\RAW_CANON_10D.CRW" | cjpeg\cjpeg.exe temp.jpg
But cjpeg isn't getting the input and show this message.
You need to call cjpeg.exe with both input and output arguments.
cjpeg.exe <input-file> <output-file>
You are calling cjpeg.exe with single argument generating the error.
cjpeg.exe temp.jpg
Actually you are trying to feed the result of the first command as the input of the cjpeg command. If dcraw returns the path of the input file then you have to execute the following:
.\dcraw-9.27-ms-64-bit.exe -c "C:\Downloads\RAW_CANON_10D.CRW" |
%{ cjpeg\cjpeg.exe $_ temp.jpg }
If dcraw returns raw binary output of the image you need to save it to a temporary file.
.\dcraw-9.27-ms-64-bit.exe -c "C:\Downloads\RAW_CANON_10D.CRW" |
Out-file temp.tiff |
%{ cjpeg\cjpeg.exe temp.tiff temp.jpg }
I'm trying to create a video quiz, that will contain small parts of other videos, concatenated together (with the purpose, that people will identify from where these short snips are taken from).
For this purpose I created a file that contain the URL of the video, the starting time of the "snip", and its length. for example:
https://www.youtube.com/watch?v=5-j6LLkpQYY 00:00 01:00
https://www.youtube.com/watch?v=b-DqO_D1g1g 14:44 01:20
https://www.youtube.com/watch?v=DPAgWKseVhg 12:53 01:00
Meaning that the first part should take the video from the first URL from its beginning and last for a minute, the second part should be taken from the second URL starting from 14:44 (minutes:seconds) and last one minute and 20 seconds and so forth.
Then all these parts should be concatenated to a single video.
I'm trying to write a script (I use ubuntu and fluent in several scripting languages) that does that, and I tried to use youtube-dl command line package and ffmpeg, but I couldn't find the right options to achieve what I need.
Any suggestions will be appreciated.
Considering the list of videos is in foo.txt, and the output video to be foo.mp4, this bash script should do the job:
eval $(cat foo.txt | while read u s d; do echo "cat <(youtube-dl -q -o - $u | ffmpeg -v error -hide_banner -i - -ss 00:$s -t 00:$d -c copy -f mpegts -);"; done | tee /dev/tty) | ffmpeg -i - -c copy foo.mp4
This is using a little trick with process substitution and eval to avoid intermediate files, container mpegts to enable simple concat protocol, and tee /dev/tty just for debugging.
I have tested with youtube-dl 2018.09.26-1 and ffmpeg 1:4.0.2-3.
I am trying to pipe a JPEG file from Image Magik's "convert" to others command line programs in other to make a benchmark. Is there a way to force a program that doesn't have a built-in functionality to read from pipe instead of reading the file from disk?
An example of a program that has such built-in functionality is "CJPEG":
convert INFILE.JPG tga:- | cjpeg -outfile OUTFILE.JPG -targa
An example of a program that doesn't ":
jpegoptim --dest OUTFOLDER INFILE.JPG
Ideally it would work like this (but it doesn't):
convert INFILE.JPG jpg:- | jpegoptim --dest OUTFOLDER -
I managed to do this though:
BASE64_IMG=$(convert INFILE.JPG jpg:- | base64)
And:
JPG<(echo "${BASE64_IMG}" | base64 --decode) /dev/stdin | awk '{print $1}'
But I don't know what to do with that...
Thanks for any help.
You can use process substitution, if the reading program doesn't expect to be able to seek to random positions within the input. (That is, it can only read continuously from the beginning of the file.)
The incorrect version (programs need to be written to accept - as a filename meaning standard input; it's not something the shell does for you):
convert INFILE.JPG jpg:- | jpegoptim --dest OUTFOLDER -
becomes
jpegoptim --dest OUTFOLDER <(convert INFILE.JPG jpg:-)
The <(...) is special bash syntax to simplify the use of a named pipe.
mkfifo input # Create a named pipe called "ipnut"
convert INFILE.JPG jpg:- > input & # Start writing to it in the background
jpegoptim --dest OUTFOLDER input # Read from the named pipe; convert blocks until jpegoptim opens the pipe for reading
rm input # Clean up after you are done
ImageMagick is failing to identify (or convert) any .eps files, with a no decode delegate error. Below is the full error. Note that running ps2pdf wrapper for Ghostscript does successfully convert the sample EPS file to PDF, but... I guess since ImageMagick can't identify the format, that probably doesn't matter.
identify: no decode delegate for this image format "/my_sample.eps" # error/constitute.c/ReadImage/552.
System info:
ImageMagick 6.8.7-0 2013-10-28 Q16
Mac OS X 10.9 (13A603)
identify -list format | grep EPS returns:
EPS PS rw- Encapsulated PostScript
EPS2* PS2 -w- Level II Encapsulated PostScript
EPS3* PS3 -w+ Level III Encapsulated PostScript
EPSF PS rw- Encapsulated PostScript
EPSI PS rw- Encapsulated PostScript Interchange format
What do
convert -list configure | grep -i delegate
convert -list delegate
return? The following file(s) contain(s) the definitions for all your local delegates' setup:
ls -l $(convert -list delegate | grep Path: | sed 's#Path: ##')
So what does
grep sDEVICE $(convert -list delegate | grep Path: | sed 's#Path: ##')
return?
It may be the case that your EPS file is tainted with some "foreign" data such as PJL commands which are prefixed to the official %!PS...-header lines. This may make the auto-identification of the file impossible. Did you check this?
To get the dimensions of a file, I can do:
$ mediainfo '--Inform=Video;%Width%x%Height%' ~/Desktop/lawandorder.mov
1920x1080
However, if I give a url instead of a file, it returns None:
$ mediainfo '--Inform=Url;%Width%x%Height%' 'http://url/lawandorder.mov'
(none)
How would I correctly pass a url to MediaInfo?
You can also use curl | head to partially download the file before running mediainfo.
Here's an example of getting the dimensions of a 12 MB file from the web, where only a small portion (less than 10 KB) from the start needs to be downloaded:
curl --silent http://www.jhepple.com/support/SampleMovies/MPEG-2.mpg \
| head --bytes 10K > temp.mpg
mediainfo '--Inform=Video;%Width%x%Height%' temp.mpg
To do this, I needed to re-compile from source using '--with-libcurl' option.
$ ./CLI_Compile.sh --with-libcurl
$ cd MediaInfo/Project/GNU/CLI
$ make install
Then I used this command to get video dimensions via http:
$ mediainfo '--Inform=Video;%Width%x%Height%' 'http://url/lawandorder.mov'
Note, this took a considerable amount of time to return the results. I'd recommend using ffmpeg if the file is not local.