Skip to content

Commit 58ced36

Browse files
committed
test(video): add test cases for variable framerate videos
Signed-off-by: yexiaochuan <[email protected]>
1 parent 87b98e8 commit 58ced36

22 files changed

+1446
-0
lines changed

test/generate_reference_resources.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,22 @@ do
7777
python3 "$TORCHCODEC_PATH/test/convert_image_to_tensor.py" "$bmp"
7878
rm -f "$bmp"
7979
done
80+
81+
# This video was generated by running the following:
82+
# ffmpeg -f lavfi -i testsrc=duration=10:size=128x128:rate=30 -vf "setpts=PTS*if(gt(N\,30)\,1.5\,1)" -c:v libx264 -bf 0 var_fps_video.mp4
83+
VIDEO_PATH=$RESOURCES_DIR/var_fps_video.mp4
84+
STREAMS=(0)
85+
86+
FRAMES=(0 1 2 3 4 5 10 15 20 25 30 35 40 45 50 55 60)
87+
for stream in "${STREAMS[@]}"; do
88+
for frame in "${FRAMES[@]}"; do
89+
frame_name=$(printf "%06d" "$frame")
90+
ffmpeg -y -i "$VIDEO_PATH" -map 0:"$stream" -vf select="eq(n\,$frame)" -vsync vfr -q:v 2 "$VIDEO_PATH.stream$stream.frame$frame_name.bmp"
91+
done
92+
done
93+
94+
for bmp in "$RESOURCES_DIR"/*.bmp
95+
do
96+
python3 "$TORCHCODEC_PATH/test/convert_image_to_tensor.py" "$bmp"
97+
rm -f "$bmp"
98+
done

test/resources/var_fps_video.mp4

35.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)