From 2953ebe7b6925b045e5652420cf07146fbbb17ab Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 11 Mar 2023 17:54:46 +0100 Subject: [PATCH] tests/fate: add a simple test for libx264 Since this is an external encoder not under our control, we cannot test the encoded output exactly as is done for internal encoders. We can still test however that the output is decodable and produces the expected number of frames with expected dimensions, pixel formats, and timestamps. --- tests/Makefile | 1 + tests/fate-run.sh | 16 +++++++ tests/fate/enc_external.mak | 6 +++ tests/ref/fate/libx264-simple | 85 +++++++++++++++++++++++++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 tests/fate/enc_external.mak create mode 100644 tests/ref/fate/libx264-simple diff --git a/tests/Makefile b/tests/Makefile index 35ea824663..e09f30a0fc 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -177,6 +177,7 @@ include $(SRC_PATH)/tests/fate/dpcm.mak include $(SRC_PATH)/tests/fate/dvvideo.mak include $(SRC_PATH)/tests/fate/ea.mak include $(SRC_PATH)/tests/fate/exif.mak +include $(SRC_PATH)/tests/fate/enc_external.mak # Must be included after lavf-video.mak include $(SRC_PATH)/tests/fate/ffmpeg.mak include $(SRC_PATH)/tests/fate/ffprobe.mak diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 61cc59acc0..e12279e4cf 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -282,6 +282,22 @@ stream_remux(){ run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tencfile || return } +# this function is for testing external encoders, +# where the precise output is not controlled by us +# we can still test e.g. that the output can be decoded correctly +enc_external(){ + srcfile=$1 + enc_fmt=$2 + enc_opt=$3 + probe_opt=$4 + + srcfile=$(target_path $srcfile) + encfile=$(target_path "${outdir}/${test}.${enc_fmt}") + + ffmpeg -i $srcfile $enc_opt -f $enc_fmt -y $encfile || return + run ffprobe${PROGSUF}${EXECSUF} -bitexact $probe_opt $encfile || return +} + # FIXME: There is a certain duplication between the avconv-related helper # functions above and below that should be refactored. ffmpeg2="$target_exec ${target_path}/ffmpeg${PROGSUF}${EXECSUF}" diff --git a/tests/fate/enc_external.mak b/tests/fate/enc_external.mak new file mode 100644 index 0000000000..7eabebcc51 --- /dev/null +++ b/tests/fate/enc_external.mak @@ -0,0 +1,6 @@ +FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX264 H264, MOV, H264_DEMUXER) += fate-libx264-simple +fate-libx264-simple: CMD = enc_external $(TARGET_SAMPLES)/h264-conformance/BA1_Sony_D.jsv \ + mp4 "-c:v libx264" "-show_entries frame=width,height,pix_fmt,pts,pkt_dts -of flat" + +FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_ENC_EXTERNAL-yes) +fate-enc-external: $(FATE_ENC_EXTERNAL-yes) diff --git a/tests/ref/fate/libx264-simple b/tests/ref/fate/libx264-simple new file mode 100644 index 0000000000..b7f7e67c3b --- /dev/null +++ b/tests/ref/fate/libx264-simple @@ -0,0 +1,85 @@ +frames.frame.0.pts=0 +frames.frame.0.pkt_dts=0 +frames.frame.0.width=176 +frames.frame.0.height=144 +frames.frame.0.pix_fmt="yuv420p" +frames.frame.1.pts=512 +frames.frame.1.pkt_dts=512 +frames.frame.1.width=176 +frames.frame.1.height=144 +frames.frame.1.pix_fmt="yuv420p" +frames.frame.2.pts=1024 +frames.frame.2.pkt_dts=1024 +frames.frame.2.width=176 +frames.frame.2.height=144 +frames.frame.2.pix_fmt="yuv420p" +frames.frame.3.pts=1536 +frames.frame.3.pkt_dts=1536 +frames.frame.3.width=176 +frames.frame.3.height=144 +frames.frame.3.pix_fmt="yuv420p" +frames.frame.4.pts=2048 +frames.frame.4.pkt_dts=2048 +frames.frame.4.width=176 +frames.frame.4.height=144 +frames.frame.4.pix_fmt="yuv420p" +frames.frame.5.pts=2560 +frames.frame.5.pkt_dts=2560 +frames.frame.5.width=176 +frames.frame.5.height=144 +frames.frame.5.pix_fmt="yuv420p" +frames.frame.6.pts=3072 +frames.frame.6.pkt_dts=3072 +frames.frame.6.width=176 +frames.frame.6.height=144 +frames.frame.6.pix_fmt="yuv420p" +frames.frame.7.pts=3584 +frames.frame.7.pkt_dts=3584 +frames.frame.7.width=176 +frames.frame.7.height=144 +frames.frame.7.pix_fmt="yuv420p" +frames.frame.8.pts=4096 +frames.frame.8.pkt_dts=4096 +frames.frame.8.width=176 +frames.frame.8.height=144 +frames.frame.8.pix_fmt="yuv420p" +frames.frame.9.pts=4608 +frames.frame.9.pkt_dts=4608 +frames.frame.9.width=176 +frames.frame.9.height=144 +frames.frame.9.pix_fmt="yuv420p" +frames.frame.10.pts=5120 +frames.frame.10.pkt_dts=5120 +frames.frame.10.width=176 +frames.frame.10.height=144 +frames.frame.10.pix_fmt="yuv420p" +frames.frame.11.pts=5632 +frames.frame.11.pkt_dts=5632 +frames.frame.11.width=176 +frames.frame.11.height=144 +frames.frame.11.pix_fmt="yuv420p" +frames.frame.12.pts=6144 +frames.frame.12.pkt_dts=6144 +frames.frame.12.width=176 +frames.frame.12.height=144 +frames.frame.12.pix_fmt="yuv420p" +frames.frame.13.pts=6656 +frames.frame.13.pkt_dts=6656 +frames.frame.13.width=176 +frames.frame.13.height=144 +frames.frame.13.pix_fmt="yuv420p" +frames.frame.14.pts=7168 +frames.frame.14.pkt_dts=7168 +frames.frame.14.width=176 +frames.frame.14.height=144 +frames.frame.14.pix_fmt="yuv420p" +frames.frame.15.pts=7680 +frames.frame.15.pkt_dts="N/A" +frames.frame.15.width=176 +frames.frame.15.height=144 +frames.frame.15.pix_fmt="yuv420p" +frames.frame.16.pts=8192 +frames.frame.16.pkt_dts="N/A" +frames.frame.16.width=176 +frames.frame.16.height=144 +frames.frame.16.pix_fmt="yuv420p"