Google VP9 ffmpeg examples error

0

On the Google developer vp9 documentation here, the recommended command ffmpeg command lines seem to be incorrectly formed.

It seems to me that the command such as this

ffmpeg -i tears_of_steel_1080p.webm -vf scale=320x240 -b:v 150k \
  -minrate 75k -maxrate 218k -tile-columns 0 -g 240 -threads 2 \
  -quality good -crf 37 -c:v libvpx-vp9 -c:a libopus \
  -pass 1 -speed 4 tos-320x240.webm && \
ffmpeg -i tears_of_steel_1080p.webm -vf scale=320x240 -b:v 150k \
  -minrate 75k -maxrate 218k -tile-columns 0 -g 240 -threads 2 \
  -quality good -crf 37 -c:v libvpx-vp9 -c:a libopus \
  -pass 2 -speed 1 -y tos-320x240.webm

should actually be more along the lines of

ffmpeg -i tears_of_steel_1080p.webm -vf scale=320x240 -b:v 150k \
  -minrate 75k -maxrate 218k -tile-columns 0 -g 240 -threads 2 \
  -quality good -crf 37 -c:v libvpx-vp9 -c:a libopus \
  -pass 1 -speed 4 -y /dev/null && \
ffmpeg -i tears_of_steel_1080p.webm -vf scale=320x240 -b:v 150k \
  -minrate 75k -maxrate 218k -tile-columns 0 -g 240 -threads 2 \
  -quality good -crf 37 -c:v libvpx-vp9 -c:a libopus \
  -pass 2 -speed 1 tos-320x240.webm

This is based on ffmpeg documentation here

However quoting the Google documentation page

'Note that the first-pass and second-pass commands are chained together. The -y argument in the second-pass command answers "Yes" when FFMpeg asks to overwrite the first-pass statistics file with the output video.'

Based on my understanding of two pass in ffmpeg, the "statistics" file will be by default in ffmpeg2pass-0.log and the actual output file is useless.

Is the libvpx-vp9 encoder using the two pass settings differently than is standard in ffmpeg? Or is Google developers page just wrong?

MR1865

Posted 2019-03-01T04:19:25.993

Reputation: 1

Answers

0

It seems to be a case of sloppy language. "the first-pass statistics file" probably refers to the encoded output generated during the statistics pass, and not the stats file. Yes, the encoded output is not the store for the stats, and can be safely discarded or not written to disk at all.

Note that -y only concerns the processed media output files and does not apply to the stats files generated by encoder first passes, or vstats_file, -report or any analytical filter file dump (like the psnr filter). These latter will always be overwritten, if present.

Gyan

Posted 2019-03-01T04:19:25.993

Reputation: 21 016

Would it not be considered "best practice" to discard the encoded output with /dev/null or NUL for to avoid unnecessary disk writes? Or am I just being nitpicky? (Which is perfectly plausible) – MR1865 – 2019-03-02T06:46:26.330

Unless you intend to inspect or use the first-pass encode in some way, yes. – Gyan – 2019-03-02T07:02:02.780