1
0

Change container's usage of /media as volume to /data to align with test-image.sh

Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
This commit is contained in:
James Ketrenos 2020-01-28 10:59:40 -08:00
parent 763a50adf1
commit 78496afb01
6 changed files with 73 additions and 77 deletions

View File

@ -18,8 +18,8 @@ Two step from zero-to-hero:
The following will download the Blender TearsOfSteel video: The following will download the Blender TearsOfSteel video:
```bash ```bash
mkdir $(pwd)/media mkdir $(pwd)/data
wget -O $(pwd)/media/TearsOfSteel.mp4 \ wget -O $(pwd)/data/TearsOfSteel.mp4 \
http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/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 ```bash
docker run \ docker run \
--device=/dev/dri \ --device=/dev/dri \
--volume $(pwd)/media:/media \ --volume $(pwd)/data:/data \
amr-registry.caas.intel.com/vtt-osgc/solutions/intel-media-ffmpeg:ubuntu-eoan \ amr-registry.caas.intel.com/vtt-osgc/solutions/intel-media-ffmpeg:ubuntu-eoan \
ffmpeg \ ffmpeg \
-hwaccel qsv \ -hwaccel qsv \
-qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \ -qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \
-c:v h264_qsv \ -c:v h264_qsv \
-i /media/TearsOfSteel.mp4 \ -i /data/TearsOfSteel.mp4 \
-c:v hevc_qsv \ -c:v hevc_qsv \
-b:v 5M \ -b:v 5M \
-y \ -y \
/media/TearsOfSteel-5M.mp4 /data/TearsOfSteel-5M.mp4
``` ```
# Getting the container # Getting the container
@ -110,8 +110,8 @@ If you are in a multicard environment, see Appendix A.
# Test hardware accelerated FFMPEG media operations # Test hardware accelerated FFMPEG media operations
First download test content into ./media, then launch First download test content into ./data, then launch
the Docker container mounting that path to the /media the Docker container mounting that path to the /data
volume, running the 'test' command. volume, running the 'test' command.
NOTE: The test media stream is currently hard coded to 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 ```bash
TAG=${TAG:-latest} TAG=${TAG:-latest}
mkdir $(pwd)/media mkdir $(pwd)/data
wget -O $(pwd)/media/AUD_MW_E.264 \ wget -O $(pwd)/data/AUD_MW_E.264 \
https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264 https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264
docker run \ docker run \
--rm \ --rm \
--device=/dev/dri \ --device=/dev/dri \
-e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \ -e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \
--volume $(pwd)/media:/media \ --volume $(pwd)/data:/data \
-it \ -it \
intel-media-ffmpeg:${TAG} \ intel-media-ffmpeg:${TAG} \
test test
@ -134,7 +134,7 @@ docker run \
The above will: 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 2. Instantiate the 'intel-media-ffmpeg' container
3. Perfom the following tests: 3. Perfom the following tests:
1. decode AUD_MW_E.264 to AUD_MW.yuv 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 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 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 AUD_MW_E.264
@ -161,15 +161,15 @@ container to transcode the stream to 5Mbps H.265 HEVC using the GPU.
```bash ```bash
TAG=${TAG:-latest} TAG=${TAG:-latest}
mkdir $(pwd)/media mkdir $(pwd)/data
wget -O $(pwd)/media/TearsOfSteel.mp4 \ wget -O $(pwd)/data/TearsOfSteel.mp4 \
http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4 http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4
docker run \ docker run \
--rm \ --rm \
--device=/dev/dri \ --device=/dev/dri \
-e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \ -e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \
-it \ -it \
--volume $(pwd)/media:/media \ --volume $(pwd)/data:/data \
intel-media-ffmpeg:${TAG} \ intel-media-ffmpeg:${TAG} \
transcode TearsOfSteel.mp4 TearsOfSteel-5M.mp4 transcode TearsOfSteel.mp4 TearsOfSteel-5M.mp4
``` ```
@ -202,10 +202,10 @@ OUT_FILE=AUD_MW.yuv
-hwaccel qsv \ -hwaccel qsv \
-qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \ -qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \
-c:v h264_qsv \ -c:v h264_qsv \
-i /media/"${IN_FILE}" \ -i /data/"${IN_FILE}" \
-vf hwdownload,format=nv12 -pix_fmt yuv420p \ -vf hwdownload,format=nv12 -pix_fmt yuv420p \
-y \ -y \
/media/"${OUT_FILE}" /data/"${OUT_FILE}"
``` ```
## Encode ## Encode
@ -225,13 +225,13 @@ OUT_FILE=AUD_MW_E.h264
-f rawvideo \ -f rawvideo \
-pix_fmt yuv420p \ -pix_fmt yuv420p \
-s:v 176x144 \ -s:v 176x144 \
-i /media/"${IN_FILE}" \ -i /data/"${IN_FILE}" \
-vf hwupload=extra_hw_frames=64,format=qsv \ -vf hwupload=extra_hw_frames=64,format=qsv \
-c:v h264_qsv \ -c:v h264_qsv \
-b:v 5M \ -b:v 5M \
-frames:v 10 \ -frames:v 10 \
-y \ -y \
/media/"${OUT_FILE}" /data/"${OUT_FILE}"
``` ```
## Transcode ## Transcode
@ -248,11 +248,11 @@ OUT_FILE=AUD_MW_E.hevc
-hwaccel qsv \ -hwaccel qsv \
-qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \ -qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \
-c:v h264_qsv \ -c:v h264_qsv \
-i /media/"${IN_FILE}" \ -i /data/"${IN_FILE}" \
-c:v hevc_qsv \ -c:v hevc_qsv \
-b:v 5M \ -b:v 5M \
-y \ -y \
/media/"${OUT_FILE}" /data/"${OUT_FILE}"
``` ```
### 1:N transcoding ### 1:N transcoding
@ -266,12 +266,12 @@ OUT_FILE=AUD_1N_
-hwaccel qsv \ -hwaccel qsv \
-qsv_device ${QSV_DEVICE} \ -qsv_device ${QSV_DEVICE} \
-c:v h264_qsv \ -c:v h264_qsv \
-i /media/"${IN_FILE}" \ -i /data/"${IN_FILE}" \
-filter_complex "split=2[s1][s2]; \ -filter_complex "split=2[s1][s2]; \
[s1]scale_qsv=1280:720[o1]; \ [s1]scale_qsv=1280:720[o1]; \
[s2]vpp_qsv=framerate=60[o2]" \ [s2]vpp_qsv=framerate=60[o2]" \
-map [o1] -c:v h264_qsv -b:v 5M /media/"${OUT_FILE}-5M.mp4" \ -map [o1] -c:v h264_qsv -b:v 5M /data/"${OUT_FILE}-5M.mp4" \
-map [o2] -c:v h264_qsv -b:v 4M /media/"${OUT_FILE}-4M60FPS.h264" -map [o2] -c:v h264_qsv -b:v 4M /data/"${OUT_FILE}-4M60FPS.h264"
``` ```
# Appendix A: Multicard # Appendix A: Multicard

View File

@ -17,7 +17,7 @@ $(info)
IN_FILE AVC (H.264) format input stream IN_FILE AVC (H.264) format input stream
OUT_FILE Base filename. "-5M.mp4" and "-4M60FPS.h264" will be added. 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 EOF
} }
@ -33,13 +33,13 @@ ffmpeg command:
-hwaccel qsv \ -hwaccel qsv \
-qsv_device ${QSV_DEVICE} \ -qsv_device ${QSV_DEVICE} \
-c:v h264_qsv \ -c:v h264_qsv \
-i /media/"\${IN_FILE}" \ -i /data/"\${IN_FILE}" \
-filter_complex "split=2[s1][s2]; \ -filter_complex "split=2[s1][s2]; \
[s1]scale_qsv=1280:720[o1]; \ [s1]scale_qsv=1280:720[o1]; \
[s2]vpp_qsv=framerate=60[o2]" \ [s2]vpp_qsv=framerate=60[o2]" \
-y \ -y \
-map [o1] -c:v h264_qsv -b:v 5M /media/"\${OUT_FILE}-5M.h264" \ -map [o1] -c:v h264_qsv -b:v 5M /data/"\${OUT_FILE}-5M.h264" \
-map [o2] -c:v h264_qsv -b:v 4M /media/"\${OUT_FILE}-4M60FPS.h264" -map [o2] -c:v h264_qsv -b:v 4M /data/"\${OUT_FILE}-4M60FPS.h264"
EOF EOF
} }
@ -81,13 +81,13 @@ QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128}
exit 1 exit 1
} }
[ ! -e /media/"${arguments[0]}" ] && { [ ! -e /data/"${arguments[0]}" ] && {
cat << EOF cat << EOF
Error: '${arguments[0]}' not found. 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? or similar?
@ -118,11 +118,11 @@ OUT_FILE="${arguments[1]}"
-hwaccel qsv \ -hwaccel qsv \
-qsv_device ${QSV_DEVICE} \ -qsv_device ${QSV_DEVICE} \
-c:v h264_qsv \ -c:v h264_qsv \
-i /media/"${IN_FILE}" \ -i /data/"${IN_FILE}" \
-filter_complex "split=2[s1][s2]; \ -filter_complex "split=2[s1][s2]; \
[s1]scale_qsv=1280:720[o1]; \ [s1]scale_qsv=1280:720[o1]; \
[s2]vpp_qsv=framerate=60[o2]" \ [s2]vpp_qsv=framerate=60[o2]" \
-y \ -y \
-map [o1] -c:v h264_qsv -b:v 5M /media/"${OUT_FILE}-5M.mp4" \ -map [o1] -c:v h264_qsv -b:v 5M /data/"${OUT_FILE}-5M.mp4" \
-map [o2] -c:v h264_qsv -b:v 4M /media/"${OUT_FILE}-4M60FPS.h264" -map [o2] -c:v h264_qsv -b:v 4M /data/"${OUT_FILE}-4M60FPS.h264"

View File

@ -17,7 +17,7 @@ $(info)
IN_FILE Input stream must be AVC (H.264) video IN_FILE Input stream must be AVC (H.264) video
OUT_FILE Output stream as YUV 420P 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 EOF
} }
@ -33,10 +33,10 @@ ffmpeg command:
-hwaccel qsv \ -hwaccel qsv \
-qsv_device \${QSV_DEVICE:-/dev/dri/renderD128} \ -qsv_device \${QSV_DEVICE:-/dev/dri/renderD128} \
-c:v h264_qsv \ -c:v h264_qsv \
-i /media/"\${IN_FILE}" \ -i /data/"\${IN_FILE}" \
-vf hwdownload,format=nv12 -pix_fmt yuv420p \ -vf hwdownload,format=nv12 -pix_fmt yuv420p \
-y \ -y \
/media/"\${OUT_FILE}" /data/"\${OUT_FILE}"
EOF EOF
} }
@ -77,13 +77,13 @@ QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128}
exit 1 exit 1
} }
[ ! -e /media/"${arguments[0]}" ] && { [ ! -e /data/"${arguments[0]}" ] && {
cat << EOF cat << EOF
Error: '${arguments[0]}' not found. 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? or similar?
@ -114,8 +114,8 @@ OUT_FILE="${arguments[1]}"
-hwaccel qsv \ -hwaccel qsv \
-qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \ -qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \
-c:v h264_qsv \ -c:v h264_qsv \
-i /media/"${IN_FILE}" \ -i /data/"${IN_FILE}" \
-vf hwdownload,format=nv12 -pix_fmt yuv420p \ -vf hwdownload,format=nv12 -pix_fmt yuv420p \
-y \ -y \
/media/"${OUT_FILE}" /data/"${OUT_FILE}"

View File

@ -17,7 +17,7 @@ $(info)
IN_FILE YUV 420p raw stream IN_FILE YUV 420p raw stream
OUT_FILE Encoded to AVC (H.264) with 5Mbps using VBR 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 EOF
} }
@ -37,12 +37,12 @@ ffmpeg command:
-f rawvideo \ -f rawvideo \
-pix_fmt yuv420p \ -pix_fmt yuv420p \
-s:v 176x144 \ -s:v 176x144 \
-i /media/\${IN_FILE} \ -i /data/\${IN_FILE} \
-vf hwupload=extra_hw_frames=64,format=qsv \ -vf hwupload=extra_hw_frames=64,format=qsv \
-c:v h264_qsv \ -c:v h264_qsv \
-b:v 5M \ -b:v 5M \
-y \ -y \
/media/\${OUT_FILE} /data/\${OUT_FILE}
EOF EOF
} }
@ -84,13 +84,13 @@ QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128}
exit 1 exit 1
} }
[ ! -e /media/"${arguments[0]}" ] && { [ ! -e /data/"${arguments[0]}" ] && {
cat << EOF cat << EOF
Error: '${arguments[0]}' not found. 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? or similar?
@ -125,9 +125,9 @@ ffmpeg \
-f rawvideo \ -f rawvideo \
-pix_fmt yuv420p \ -pix_fmt yuv420p \
-s:v 176x144 \ -s:v 176x144 \
-i /media/${IN_FILE} \ -i /data/${IN_FILE} \
-vf hwupload=extra_hw_frames=64,format=qsv \ -vf hwupload=extra_hw_frames=64,format=qsv \
-c:v h264_qsv \ -c:v h264_qsv \
-b:v 5M \ -b:v 5M \
-y \ -y \
/media/${OUT_FILE} /data/${OUT_FILE}

View File

@ -68,13 +68,13 @@ QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128}
exit 1 exit 1
} }
[ ! -d /media/. ] && { [ ! -d /data/. ] && {
cat << EOF 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? or similar?
@ -98,26 +98,22 @@ EOF
exit 2 exit 2
} }
[ ! -e "/media/AUD_MW_E.264" ] && { [ ! -e "/data/AUD_MW_E.264" ] && {
cat << EOF cat << EOF
Error: Test file h264 (AVC) not found. Is /media mounted? Test file h264 (AVC) not found. Attempting to download to /data
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 ...
EOF 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=( tests=(

View File

@ -17,7 +17,7 @@ $(info)
IN_FILE AVC (H.264) format input stream IN_FILE AVC (H.264) format input stream
OUT_FILE HEVC (H.265) output 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 EOF
} }
@ -34,11 +34,11 @@ ffmpeg command:
-hwaccel qsv \ -hwaccel qsv \
-qsv_device \${QSV_DEVICE:-/dev/dri/renderD128} \ -qsv_device \${QSV_DEVICE:-/dev/dri/renderD128} \
-c:v h264_qsv \ -c:v h264_qsv \
-i /media/"\${IN_FILE}" \ -i /data/"\${IN_FILE}" \
-c:v hevc_qsv \ -c:v hevc_qsv \
-b:v 5M \ -b:v 5M \
-y \ -y \
/media/"\${OUT_FILE}" /data/"\${OUT_FILE}"
EOF EOF
} }
@ -80,13 +80,13 @@ QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128}
exit 1 exit 1
} }
[ ! -e /media/"${arguments[0]}" ] && { [ ! -e /data/"${arguments[0]}" ] && {
cat << EOF cat << EOF
Error: '${arguments[0]}' not found. 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? or similar?
@ -118,8 +118,8 @@ OUT_FILE="${arguments[1]}"
-hwaccel qsv \ -hwaccel qsv \
-qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \ -qsv_device ${QSV_DEVICE:-/dev/dri/renderD128} \
-c:v h264_qsv \ -c:v h264_qsv \
-i /media/"${IN_FILE}" \ -i /data/"${IN_FILE}" \
-c:v hevc_qsv \ -c:v hevc_qsv \
-b:v 5M \ -b:v 5M \
-y \ -y \
/media/"${OUT_FILE}" /data/"${OUT_FILE}"