ITS: Check the video profile file format.
Check the output file format and save the recording with
appropriate extension. File format 3gpp and webm will be saved
with .3gp and .webm extensions. All others will be saved with
.mp4 formats.
Bug: 228065556
Test: test_video_aspect_ratio_and_crop on pixel device.
Verified that low and qcif quality video files were saved with
.3gp format.
Change-Id: Iba40afdbda886ec49e1dee9501ec6237ae64f087
diff --git a/apps/CameraITS/utils/video_processing_utils.py b/apps/CameraITS/utils/video_processing_utils.py
index f862c59..dc809cb 100644
--- a/apps/CameraITS/utils/video_processing_utils.py
+++ b/apps/CameraITS/utils/video_processing_utils.py
@@ -36,13 +36,13 @@
)
-def extract_key_frames_from_video(log_path, mp4_file_name):
+def extract_key_frames_from_video(log_path, video_file_name):
"""
Returns a list of extracted key frames.
Ffmpeg tool is used to extract key frames from the video at path
- os.path.join(log_path, mp4_file_name).
- The extracted key frames will have the name mp4_file_name with "_key_frame"
+ os.path.join(log_path, video_file_name).
+ The extracted key frames will have the name video_file_name with "_key_frame"
suffix to identify the frames for video of each quality.Since there can be
multiple key frames, each key frame image will be differentiated with it's
frame index.All the extracted key frames will be available in jpeg format
@@ -50,26 +50,26 @@
Args:
log_path: path for video file directory
- mp4_file_name: name of the file in mp4 format.
+ video_file_name: name of the video file.
Ex: VID_20220325_050918_0_CIF_352x288.mp4
Returns:
key_frame_files: A list of paths for each key frame extracted from the
video.
"""
- ffmpeg_image_name = f"{mp4_file_name.split('.')[0]}_key_frame"
+ ffmpeg_image_name = f"{video_file_name.split('.')[0]}_key_frame"
ffmpeg_image_file_path = os.path.join(log_path, ffmpeg_image_name + '_%02d.png')
cmd = ['ffmpeg',
'-skip_frame',
'nokey',
'-i',
- os.path.join(log_path, mp4_file_name),
+ os.path.join(log_path, video_file_name),
'-vsync',
'vfr',
'-frame_pts',
'true' ,
ffmpeg_image_file_path,
]
- logging.debug('Extracting key frames for: %s' % mp4_file_name)
+ logging.debug('Extracting key frames from: %s' % video_file_name)
output = subprocess.call(cmd)
arr = os.listdir(os.path.join(log_path))
key_frame_files = []