Skip to content

Cookbook

gadfly16 edited this page May 17, 2019 · 6 revisions

Until we have a practical implementation of Teflon, we can still use the building blocks that Teflon will be able to automate later. This cookbook is a list of commands and options that proved to be useful in our work. Please read the White Paper to understand the workflow that we are trying to implement, to see how these examples fit into the bigger picture.

This document has the following sections:

  1. FFmpeg Recepies
  2. OIIOtool Recepies

FFmpeg Recepies

This section collects recepies regarding the FFmpeg utility. FFmpeg's strength lies in the ability to process video formats and it's weakness is the lack of outputting floatingpoint images and coherent color correction.

General option notes

  • -y : answers yes to overwrite questions.
  • -g N : keyframe every Nth keyframes, to tune scrub performance.
  • -start_number: use this if a sequence does not start at 0 or 1. Use it before the -i it belongs.
  • -ss: fast seek into the file in seconds. Use it before the -i it belongs.
  • -t: length of conversion in seconds.
  • -vf scale=320:240: scales the output image. See the Scaling Wiki for details.
  • -hide_banner : removes the banner from the beginning of output.

Get metadata

ffprobe -hide_banner video_file.mov

Get codec options

ffmpeg -h encoder=hevc_nvenc

Converting sequence to DNxHD for editing

ffmpeg -i h264/test.mov -c:v dnxhd -b:v 36M test.mov

Converting sequence to VP9

One pass, keyframe-every frame

ffmpeg -i input.%06d.tif -r:v 24 -c:v libvpx-vp9 -g 1 -crf 23 -b:v 2000k output.webm

Two pass

ffmpeg -i test_sequence.%06d.tif -r:v 24 -c:v libvpx-vp9 -pass 1 -b:v 8000K -g 6 -crf 11 -threads 8 -speed 2 \
  -tile-columns 6 -frame-parallel 1 \
  -an -f webm /dev/null && \
ffmpeg -i test_sequence.%06d.tif -r:v 24 -c:v libvpx-vp9 -pass 2 -b:v 8000K -g 6 -crf 11 -threads 8 -speed 2 \
  -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 \
  -c:a libopus -b:a 64k -f webm test_video.webm

Converting sequence to H264 with Nvidia GPU

ffmpeg -i test_sequence_%06d.tif -c:v h264_nvenc -preset slow -b:v 8M -g 6 test_video.mp4

Converting EXR sequence to H264

SW encoding

ffmpeg -apply_trc iec61966_2_1 -i input_%06d.exr output.mp4

HW encoding on Nvidia GPU

ffmpeg -apply_trc iec61966_2_1 -i input_%06d.exr -pix_fmt yuv420p \
    -c:v h264_nvenc -preset slow -b:v 8M -g 6 output.mp4

Slicing Video Files

With fast seek

ffmpeg -ss 16.333333 -i test_video.mov \
    -t 7.083333 test_sequence.%06d.tif

Oiiotool Recepies

This section collects recepies regarding the OpenImageIO's oiiotool utility. Oiiotools' strength is the handling of sequences of still images and the integration of OpenColorIO, while it's weakness is the lack of professional support of video stream formats.

General option notes

  • -d: Sets the data format, for example uint8.

Getting image info in XML

oiiotool --info:format=xml -v test_image.jpg

Converting a jpg proxy

oiiotool test.1-100%d.tif --quality 95 --resize 50% -o jpg/test.1-100%d.jpg

Converting temporary TIF sequence from EXR

oiiotool -v test_sequence_%06d.exr \
    --colorconvert linear sRGB -ch R,G,B -d uint8 --compression none \
    -o /tmp/teflon_arena/test_sequence_%06d.tif