From 78496afb01cf9d99f61fa89975508f2a25d3e979 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Tue, 28 Jan 2020 10:59:40 -0800 Subject: [PATCH] Change container's usage of /media as volume to /data to align with test-image.sh Signed-off-by: James Ketrenos --- README.md | 48 ++++++++++++++++++------------------ assets/commands/1N_transcode | 20 +++++++-------- assets/commands/decode | 16 ++++++------ assets/commands/encode | 16 ++++++------ assets/commands/test | 34 +++++++++++-------------- assets/commands/transcode | 16 ++++++------ 6 files changed, 73 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 796626d..1b9738b 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ Two step from zero-to-hero: The following will download the Blender TearsOfSteel video: ```bash -mkdir $(pwd)/media -wget -O $(pwd)/media/TearsOfSteel.mp4 \ +mkdir $(pwd)/data +wget -O $(pwd)/data/TearsOfSteel.mp4 \ http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4 ``` @@ -31,17 +31,17 @@ The following will transcode 'TearsOfSteal.mp4' from AVC (H.264) to a ```bash docker run \ --device=/dev/dri \ - --volume $(pwd)/media:/media \ + --volume $(pwd)/data:/data \ amr-registry.caas.intel.com/vtt-osgc/solutions/intel-media-ffmpeg:ubuntu-eoan \ ffmpeg \ -hwaccel qsv \ -qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \ -c:v h264_qsv \ - -i /media/TearsOfSteel.mp4 \ + -i /data/TearsOfSteel.mp4 \ -c:v hevc_qsv \ -b:v 5M \ -y \ - /media/TearsOfSteel-5M.mp4 + /data/TearsOfSteel-5M.mp4 ``` # Getting the container @@ -110,8 +110,8 @@ If you are in a multicard environment, see Appendix A. # Test hardware accelerated FFMPEG media operations -First download test content into ./media, then launch -the Docker container mounting that path to the /media +First download test content into ./data, then launch +the Docker container mounting that path to the /data volume, running the 'test' command. NOTE: The test media stream is currently hard coded to @@ -119,14 +119,14 @@ expect the name AUD_WM_E.264 in the container. ```bash TAG=${TAG:-latest} -mkdir $(pwd)/media -wget -O $(pwd)/media/AUD_MW_E.264 \ +mkdir $(pwd)/data +wget -O $(pwd)/data/AUD_MW_E.264 \ https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264 docker run \ --rm \ --device=/dev/dri \ -e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \ - --volume $(pwd)/media:/media \ + --volume $(pwd)/data:/data \ -it \ intel-media-ffmpeg:${TAG} \ test @@ -134,7 +134,7 @@ docker run \ The above will: -1. Download a test content file from fate-suite.libav.org into $(pwd)/media +1. Download a test content file from fate-suite.libav.org into $(pwd)/data 2. Instantiate the 'intel-media-ffmpeg' container 3. Perfom the following tests: 1. decode AUD_MW_E.264 to AUD_MW.yuv @@ -142,7 +142,7 @@ The above will: 3. transcode AUD_MW_E.264 to AUD_MW_E.hevc 4. transcode AUD_MW_E.264 to two streams at once, AUD_1N-5M.h264 and AUD_1N-4M60FPS.h264 -Once completed, you can check the contents of $(pwd)/media for the following files: +Once completed, you can check the contents of $(pwd)/data for the following files: ``` AUD_MW_E.264 @@ -161,15 +161,15 @@ container to transcode the stream to 5Mbps H.265 HEVC using the GPU. ```bash TAG=${TAG:-latest} -mkdir $(pwd)/media -wget -O $(pwd)/media/TearsOfSteel.mp4 \ +mkdir $(pwd)/data +wget -O $(pwd)/data/TearsOfSteel.mp4 \ http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4 docker run \ --rm \ --device=/dev/dri \ -e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \ -it \ - --volume $(pwd)/media:/media \ + --volume $(pwd)/data:/data \ intel-media-ffmpeg:${TAG} \ transcode TearsOfSteel.mp4 TearsOfSteel-5M.mp4 ``` @@ -202,10 +202,10 @@ OUT_FILE=AUD_MW.yuv -hwaccel qsv \ -qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \ -c:v h264_qsv \ - -i /media/"${IN_FILE}" \ + -i /data/"${IN_FILE}" \ -vf hwdownload,format=nv12 -pix_fmt yuv420p \ -y \ - /media/"${OUT_FILE}" + /data/"${OUT_FILE}" ``` ## Encode @@ -225,13 +225,13 @@ OUT_FILE=AUD_MW_E.h264 -f rawvideo \ -pix_fmt yuv420p \ -s:v 176x144 \ - -i /media/"${IN_FILE}" \ + -i /data/"${IN_FILE}" \ -vf hwupload=extra_hw_frames=64,format=qsv \ -c:v h264_qsv \ -b:v 5M \ -frames:v 10 \ -y \ - /media/"${OUT_FILE}" + /data/"${OUT_FILE}" ``` ## Transcode @@ -248,11 +248,11 @@ OUT_FILE=AUD_MW_E.hevc -hwaccel qsv \ -qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \ -c:v h264_qsv \ - -i /media/"${IN_FILE}" \ + -i /data/"${IN_FILE}" \ -c:v hevc_qsv \ -b:v 5M \ -y \ - /media/"${OUT_FILE}" + /data/"${OUT_FILE}" ``` ### 1:N transcoding @@ -266,12 +266,12 @@ OUT_FILE=AUD_1N_ -hwaccel qsv \ -qsv_device ${QSV_DEVICE} \ -c:v h264_qsv \ - -i /media/"${IN_FILE}" \ + -i /data/"${IN_FILE}" \ -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/"${OUT_FILE}-5M.mp4" \ - -map [o2] -c:v h264_qsv -b:v 4M /media/"${OUT_FILE}-4M60FPS.h264" + -map [o1] -c:v h264_qsv -b:v 5M /data/"${OUT_FILE}-5M.mp4" \ + -map [o2] -c:v h264_qsv -b:v 4M /data/"${OUT_FILE}-4M60FPS.h264" ``` # Appendix A: Multicard diff --git a/assets/commands/1N_transcode b/assets/commands/1N_transcode index 4a4c0a3..9a0d707 100755 --- a/assets/commands/1N_transcode +++ b/assets/commands/1N_transcode @@ -17,7 +17,7 @@ $(info) IN_FILE AVC (H.264) format input stream OUT_FILE Base filename. "-5M.mp4" and "-4M60FPS.h264" will be added. -NOTE: Above paths are read from the container volume /media. +NOTE: Above paths are read from the container volume /data. EOF } @@ -33,13 +33,13 @@ ffmpeg command: -hwaccel qsv \ -qsv_device ${QSV_DEVICE} \ -c:v h264_qsv \ - -i /media/"\${IN_FILE}" \ + -i /data/"\${IN_FILE}" \ -filter_complex "split=2[s1][s2]; \ [s1]scale_qsv=1280:720[o1]; \ [s2]vpp_qsv=framerate=60[o2]" \ -y \ - -map [o1] -c:v h264_qsv -b:v 5M /media/"\${OUT_FILE}-5M.h264" \ - -map [o2] -c:v h264_qsv -b:v 4M /media/"\${OUT_FILE}-4M60FPS.h264" + -map [o1] -c:v h264_qsv -b:v 5M /data/"\${OUT_FILE}-5M.h264" \ + -map [o2] -c:v h264_qsv -b:v 4M /data/"\${OUT_FILE}-4M60FPS.h264" EOF } @@ -81,13 +81,13 @@ QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} exit 1 } -[ ! -e /media/"${arguments[0]}" ] && { +[ ! -e /data/"${arguments[0]}" ] && { cat << EOF Error: '${arguments[0]}' not found. -Was the volume /media mounted when launching the container? +Was the volume /data mounted when launching the container? - docker ... --volume \$(pwd)/media:/media ... + docker ... --volume \$(pwd)/data:/data ... or similar? @@ -118,11 +118,11 @@ OUT_FILE="${arguments[1]}" -hwaccel qsv \ -qsv_device ${QSV_DEVICE} \ -c:v h264_qsv \ - -i /media/"${IN_FILE}" \ + -i /data/"${IN_FILE}" \ -filter_complex "split=2[s1][s2]; \ [s1]scale_qsv=1280:720[o1]; \ [s2]vpp_qsv=framerate=60[o2]" \ -y \ - -map [o1] -c:v h264_qsv -b:v 5M /media/"${OUT_FILE}-5M.mp4" \ - -map [o2] -c:v h264_qsv -b:v 4M /media/"${OUT_FILE}-4M60FPS.h264" + -map [o1] -c:v h264_qsv -b:v 5M /data/"${OUT_FILE}-5M.mp4" \ + -map [o2] -c:v h264_qsv -b:v 4M /data/"${OUT_FILE}-4M60FPS.h264" diff --git a/assets/commands/decode b/assets/commands/decode index b1f92e8..ed2e38d 100755 --- a/assets/commands/decode +++ b/assets/commands/decode @@ -17,7 +17,7 @@ $(info) IN_FILE Input stream must be AVC (H.264) video OUT_FILE Output stream as YUV 420P -NOTE: Above paths are read from the container volume /media. +NOTE: Above paths are read from the container volume /data. EOF } @@ -33,10 +33,10 @@ ffmpeg command: -hwaccel qsv \ -qsv_device \${QSV_DEVICE:-/dev/dri/renderD128} \ -c:v h264_qsv \ - -i /media/"\${IN_FILE}" \ + -i /data/"\${IN_FILE}" \ -vf hwdownload,format=nv12 -pix_fmt yuv420p \ -y \ - /media/"\${OUT_FILE}" + /data/"\${OUT_FILE}" EOF } @@ -77,13 +77,13 @@ QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} exit 1 } -[ ! -e /media/"${arguments[0]}" ] && { +[ ! -e /data/"${arguments[0]}" ] && { cat << EOF Error: '${arguments[0]}' not found. -Was the volume /media mounted when launching the container? +Was the volume /data mounted when launching the container? - docker ... --volume \$(pwd)/media:/media ... + docker ... --volume \$(pwd)/data:/data ... or similar? @@ -114,8 +114,8 @@ OUT_FILE="${arguments[1]}" -hwaccel qsv \ -qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \ -c:v h264_qsv \ - -i /media/"${IN_FILE}" \ + -i /data/"${IN_FILE}" \ -vf hwdownload,format=nv12 -pix_fmt yuv420p \ -y \ - /media/"${OUT_FILE}" + /data/"${OUT_FILE}" diff --git a/assets/commands/encode b/assets/commands/encode index e091dd4..27b26b5 100755 --- a/assets/commands/encode +++ b/assets/commands/encode @@ -17,7 +17,7 @@ $(info) IN_FILE YUV 420p raw stream OUT_FILE Encoded to AVC (H.264) with 5Mbps using VBR -NOTE: Above paths are read from the container volume /media. +NOTE: Above paths are read from the container volume /data. EOF } @@ -37,12 +37,12 @@ ffmpeg command: -f rawvideo \ -pix_fmt yuv420p \ -s:v 176x144 \ - -i /media/\${IN_FILE} \ + -i /data/\${IN_FILE} \ -vf hwupload=extra_hw_frames=64,format=qsv \ -c:v h264_qsv \ -b:v 5M \ -y \ - /media/\${OUT_FILE} + /data/\${OUT_FILE} EOF } @@ -84,13 +84,13 @@ QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} exit 1 } -[ ! -e /media/"${arguments[0]}" ] && { +[ ! -e /data/"${arguments[0]}" ] && { cat << EOF Error: '${arguments[0]}' not found. -Was the volume /media mounted when launching the container? +Was the volume /data mounted when launching the container? - docker ... --volume \$(pwd)/media:/media ... + docker ... --volume \$(pwd)/data:/data ... or similar? @@ -125,9 +125,9 @@ ffmpeg \ -f rawvideo \ -pix_fmt yuv420p \ -s:v 176x144 \ - -i /media/${IN_FILE} \ + -i /data/${IN_FILE} \ -vf hwupload=extra_hw_frames=64,format=qsv \ -c:v h264_qsv \ -b:v 5M \ -y \ - /media/${OUT_FILE} + /data/${OUT_FILE} diff --git a/assets/commands/test b/assets/commands/test index e02c276..51042ad 100755 --- a/assets/commands/test +++ b/assets/commands/test @@ -68,13 +68,13 @@ QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} exit 1 } -[ ! -d /media/. ] && { +[ ! -d /data/. ] && { cat << EOF -Error: '/media/' not found. +Error: '/data/' found. -Was the volume /media mounted when launching the container? +Was the volume /data mounted when launching the container? - docker ... --volume \$(pwd)/media:/media ... + docker ... --volume \$(pwd)/data:/data ... or similar? @@ -98,26 +98,22 @@ EOF exit 2 } -[ ! -e "/media/AUD_MW_E.264" ] && { +[ ! -e "/data/AUD_MW_E.264" ] && { cat << EOF -Error: Test file h264 (AVC) not found. Is /media mounted? - -You can download a test stream via: - - mkdir -p \$(pwd)/media - wget -O \$(pwd)/media/AUD_MW_E.264 \\ - 'https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264' - -Once downloaded, re-run this test. When you launch the Docker -container, make sure you mount the '\$(pwd)/media' path as -the /media volume via: - - docker ... --volume \$(pwd)/media:/media ... +Test file h264 (AVC) not found. Attempting to download to /data EOF - exit 3 + wget -O /data/AUD_MW_E.264 \\ + 'https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264' || { +2>&1 cat << EOF + +Error: Unable to download AUD_WM_E.264 + +EOF + exit 2 + } } tests=( diff --git a/assets/commands/transcode b/assets/commands/transcode index cf5249c..daf5644 100755 --- a/assets/commands/transcode +++ b/assets/commands/transcode @@ -17,7 +17,7 @@ $(info) IN_FILE AVC (H.264) format input stream OUT_FILE HEVC (H.265) output stream -NOTE: Above paths are read from the container volume /media. +NOTE: Above paths are read from the container volume /data. EOF } @@ -34,11 +34,11 @@ ffmpeg command: -hwaccel qsv \ -qsv_device \${QSV_DEVICE:-/dev/dri/renderD128} \ -c:v h264_qsv \ - -i /media/"\${IN_FILE}" \ + -i /data/"\${IN_FILE}" \ -c:v hevc_qsv \ -b:v 5M \ -y \ - /media/"\${OUT_FILE}" + /data/"\${OUT_FILE}" EOF } @@ -80,13 +80,13 @@ QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} exit 1 } -[ ! -e /media/"${arguments[0]}" ] && { +[ ! -e /data/"${arguments[0]}" ] && { cat << EOF Error: '${arguments[0]}' not found. -Was the volume /media mounted when launching the container? +Was the volume /data mounted when launching the container? - docker ... --volume \$(pwd)/media:/media ... + docker ... --volume \$(pwd)/data:/data ... or similar? @@ -118,8 +118,8 @@ OUT_FILE="${arguments[1]}" -hwaccel qsv \ -qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \ -c:v h264_qsv \ - -i /media/"${IN_FILE}" \ + -i /data/"${IN_FILE}" \ -c:v hevc_qsv \ -b:v 5M \ -y \ - /media/"${OUT_FILE}" + /data/"${OUT_FILE}"