Skip to content

Variable FPS tests #761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions test/generate_reference_resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ for frame in "${FRAMES[@]}"; do
ffmpeg -y -i "$VIDEO_PATH" -vf select="eq(n\,$frame)" -vsync vfr -q:v 2 "$VIDEO_PATH.stream0.frame$frame_name.bmp"
done

for bmp in "$RESOURCES_DIR"/*.bmp
do
python3 "$TORCHCODEC_PATH/test/convert_image_to_tensor.py" "$bmp"
rm -f "$bmp"
done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive by. I realized we had this logic twice: here and again at the end of the script. We only want it once. The dupe was introduced back in #448.

# This video was generated by running the following:
# ffmpeg -f lavfi -i testsrc=duration=5:size=640x360:rate=25,format=yuv420p -c:v libaom-av1 -crf 30 -colorspace bt709 -color_primaries bt709 -color_trc bt709 av1_video.mkv
# Note that this video only has 1 stream, at index 0.
Expand All @@ -72,6 +66,19 @@ for frame in "${FRAMES[@]}"; do
ffmpeg -y -i "$VIDEO_PATH" -vf select="eq(n\,$frame)" -vsync vfr -q:v 2 "$VIDEO_PATH.stream0.frame$frame_name.bmp"
done

# This video was generated by running the following:
# 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
VIDEO_PATH=$RESOURCES_DIR/var_fps_video.mp4
STREAMS=(0)

FRAMES=(0 150 151 152 153 154 155 156 157 158 159 299)
for stream in "${STREAMS[@]}"; do
for frame in "${FRAMES[@]}"; do
frame_name=$(printf "%06d" "$frame")
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"
done
done

for bmp in "$RESOURCES_DIR"/*.bmp
do
python3 "$TORCHCODEC_PATH/test/convert_image_to_tensor.py" "$bmp"
Expand Down
Binary file added test/resources/var_fps_video.mp4
Binary file not shown.
Loading
Loading