From 08246a181659d8a2ca7a8e2fe326d2ec04dc85dd Mon Sep 17 00:00:00 2001 From: "James P. Ketrenos" Date: Tue, 17 Sep 2019 14:41:21 -0700 Subject: [PATCH] Add examples Signed-off-by: James P. Ketrenos --- README.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/README.md b/README.md index 6f6e759..b440684 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,86 @@ docker run \ intel-media-ffmpeg ``` +# Usage examples + +Download stream: + +```bash +mkdir media +cd media +wget https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264 +cd .. +``` + +## Decode + +H264 video decode and save as raw file: + +### Connect to container +```bash +docker run \ + --rm \ + --device=/dev/dri \ + --volume $(pwd)/media:/media \ + -it \ + intel-media-ffmpeg \ + ffmpeg -hwaccel qsv -c:v h264_qsv -i /media/AUD_MW_E.264 \ + -vf hwdownload,format=nv12 -pix_fmt yuv420p \ + /media/AUD_MW.yuv +``` + +### Encode + +Encode a 10 frames of 720p raw input as H264 with 5Mbps using VBR mode: + +```bash +docker run \ + --rm \ + --device=/dev/dri \ + --volume $(pwd)/media:/media \ + -it \ + intel-media-ffmpeg \ + ffmpeg -loglevel debug -init_hw_device qsv=hw \ + -filter_hw_device hw -f rawvideo -pix_fmt \ + yuv420p -s:v 176x144 -i /media/AUD_MW.yuv -vf \ + hwupload=extra_hw_frames=64,format=qsv \ + -c:v h264_qsv -b:v 5M -frames:v 10 \ + -y /media/AUD_MW_E.h264 +``` + +### Transcode + +H264 decode && H265 encode with 5Mbps using VBR + +```bash +docker run \ + --rm \ + --device=/dev/dri \ + --volume $(pwd)/media:/media \ + -it \ + intel-media-ffmpeg \ + ffmpeg -hwaccel qsv -c:v h264_qsv -i /media/AUD_MW_E.264 \ + -c:v hevc_qsv -b:v 5M AUD_MW_E.hevc +``` + +1:N transcoding + +```bash +docker run \ + --rm \ + --device=/dev/dri \ + --volume $(pwd)/media:/media \ + -it \ + intel-media-ffmpeg \ + ffmpeg -hwaccel qsv -c:v h264_qsv \ + -i /media/AUD_MW_E.264 \ + -filter_complex "split=2[s1][s2]; \ + [s1]scale_qsv=1280:720[o1]; \ + [s2]vpp_qsv=framerate=60[o2]" \ + -map [o1] -c:v h264_qsv -b:v 5M /media/5M.mp4 \ + -map [o2] -c:v h264_qsv -b:v 4M /media/4M60FPS.h264 +``` + ## Developing The Dockerfile itself is constructed from re-usable snippets,