Reputation: 59
To force ffmpeg to read, decode, and scale only once in order to bring CPU usage down I put those steps in one ffmpeg process and piped the result into another ffmpeg process that performed the encoding.
This improved the overall processing time by 15–20%.
INPUT_STREAM="ffmpeg -i $INPUT_FILE -vf scale=720:-1,crop=720:400 -threads auto -f yuv4mpegpipe -"
$INPUT_STREAM | ffmpeg -y -f yuv4mpegpipe -i - \
$AUDIO_OPTIONS_P2 $VIDEO_OPTIONS_P2 -b:v 250k -threads auto out-250.mp4 \
$AUDIO_OPTIONS_P2 $VIDEO_OPTIONS_P2 -b:v 500k -threads auto out-500.mp4 \
$AUDIO_OPTIONS_P2 $VIDEO_OPTIONS_P2 -b:v 700k -threads auto out-700.mp4
I then tried the syntax below:
ffmpeg -i c:\sample.mp4 -threads auto -f yuv4mpegpipe - | ffmpeg -y -f yuv4mpegpipe -i -vcodec libx264 -b:v 250k -threads auto c:\out-250.mp4 -vcodec libx264 -b:v 260k -threads auto c:\out-260.mp4
… but this error appears:
At least one output file must be specified
But I have specified the out put file which is: C:\out-260.mp4
. Still it doesn't work
What's wrong?
Upvotes: 0
Views: 6169
Reputation: 38672
ffmpeg -y -f yuv4mpegpipe -i -vcodec …
You didn't specify any input file. To read from stdin, use -
:
ffmpeg -y -f yuv4mpegpipe -i - -vcodec …
Upvotes: 1