ITS: test_preview_zoom: Fix missing frames from mp4
ffmpeg command was returning less frames compared to frames reported by
ffprobe command. -vsync passthrough ignores the input frame rate and
passes it through to the output unchanged.
Bug: 338462921
Test: test_preview_zoom.py
Change-Id: I0dfead300cfa28f0bc92878946b626fcba7cfec1
diff --git a/apps/CameraITS/utils/video_processing_utils.py b/apps/CameraITS/utils/video_processing_utils.py
index 964cde4..1386f37 100644
--- a/apps/CameraITS/utils/video_processing_utils.py
+++ b/apps/CameraITS/utils/video_processing_utils.py
@@ -222,10 +222,10 @@
ffmpeg_image_name = f"{video_file_name.split('.')[0]}_frame"
logging.debug('ffmpeg_image_name: %s', ffmpeg_image_name)
ffmpeg_image_file_names = (
- f'{os.path.join(log_path, ffmpeg_image_name)}_%03d.{img_format}')
+ f'{os.path.join(log_path, ffmpeg_image_name)}_%04d.{img_format}')
cmd = [
'ffmpeg', '-i', os.path.join(log_path, video_file_name),
- '-vsync', 'vfr', # force ffmpeg to use video fps instead of inferred fps
+ '-vsync', 'passthrough', # prevents frame drops during decoding
ffmpeg_image_file_names, '-loglevel', 'quiet'
]
_ = subprocess.call(cmd,