Guig
Guig

Reputation: 10197

pipe ffmpeg output for video preview

I want to pipe ffmpeg output to be able to get it as a stream. More precisely, I have a video that is remotely hosted and I want to compute a preview and save it directly to S3.

ffmpeg -i http://mywebsite.com/video.mp4 -ss 00:00:01 -vframes 1 -f image2 ~/test.jpg

works (no streaming here) but this doesn't:

ffmpeg -i http://mywebsite.com/video.mp4 -ss 00:00:01 -vframes 1 -f image2 pipe:1 | echo > ~/Downloads/test.image2

The latest will create a 1 byte file that is obviously not the desired output. I don't know what format image2 is but I had to specified an output format for the streaming command to run. It works fine without streaming.

Any clue?

Upvotes: 0

Views: 1371

Answers (1)

Jorge Torres
Jorge Torres

Reputation: 1466

The problem is "echo". I think that you meant to use "cat" instead:

ffmpeg -i http://mywebsite.com/video.mp4 -ss 00:00:01 -vframes 1 -f image2 pipe:1 | cat > ~/Downloads/test.image2

By calling echo you were outputing to stdout a new line, which was saved in your file. Cat takes the data stream from the pipe, and "concatenates" that strean into the file where you redirect your output.

Upvotes: 1

Related Questions