Hi guys,
On PySceneDetect, they said
"Print a table of detected scenes to the terminal, and save an image at the start, middle, and end frame of each scene:
scenedetect -i video.mp4 detect-content list-scenes -n save-images"
I just want to save only the middle frame of each scene. Do you guys know how to do it? Please help me with the code. Thank you in advance.
P/S: I have been making a montage image with start, middle, and end frame of each scene for summary and analyzing the news. There are more than 10000 keyframes embedded. I think it is so many. Start and end frame are quite useless. The file is too large and the size is quite unusual.
+ Reply to Thread
Results 1 to 2 of 2
-
Last edited by JeremyVN; 5th Jul 2022 at 11:00.
-
" Usage Examples
Print table of detected scenes for video.mp4 and save to CSV file video-Scenes.csv:
scenedetect --input video.mp4 detect-content list-scenes
Same as above, but don’t create output file:
scenedetect --input video.mp4 detect-content list-scenes -n
save-images
The save-images command creates images for each detected scene. It saves a set number of images for each detected scene, always including the first and last frames.
Command Options
-o, --output DIR
Output directory to save images to. Overrides global option -o/–output if set.
-f, --filename NAME
Filename format, without extension, to use when saving image files. You can use the $VIDEO_NAME, $SCENE_NUMBER, $IMAGE_NUMBER, and $FRAME_NUMBER macros in the file name. Note that you may have to wrap the format in single quotes. [default: $VIDEO_NAME- Scene-$SCENE_NUMBER-$IMAGE_NUMBER]
-n, --num-images N
Number of images to generate. Will always include start/end frame, unless N = 1, in which case the image will be the frame at the mid-point in the scene. [default: 3]
-j, --jpeg
Set output format to JPEG (default).
-w, --webp
Set output format to WebP
-q, --quality Q
JPEG/WebP encoding quality, from 0-100 (higher indicates better quality). For WebP, 100 indicates lossless. [default: JPEG: 95, WebP: 100]
-p, --png
Set output format to PNG.
-c, --compression C
PNG compression rate, from 0-9. Higher values produce smaller files but result in longer compression time. This setting does not affect image quality, only file size. [default: 3]
-m, --frame-margin N
Number of frames to ignore at the beginning and end of scenes when saving images. [default: 3]
-s, --scale S
Optional factor by which saved images are rescaled. A scaling factor of 1 would not result in rescaling. A value <1 results in a smaller saved image, while a value >1 results in an image larger than the original. This value is ignored if either the height, -h, or width, -w, values are specified.
-h, --height H
Optional value for the height of the saved images. Specifying both the height and width, -w, will resize images to an exact size, regardless of aspect ratio. Specifying only height will rescale the image to that number of pixels in height while preserving the aspect ratio.
-w, --width W
Optional value for the width of the saved images. Specifying both the width and height, -h, will resize images to an exact size, regardless of aspect ratio. Specifying only width will rescale the image to that number of pixels wide while preserving the aspect ratio."
I tried to change -n = 1, --num-images N = 1, -N = 1, but none of them works. PLEASE HELP.Last edited by JeremyVN; 5th Jul 2022 at 11:00.
Similar Threads
-
Pyscenedetect - "Video file not found" error - PLEASE HELP
By JeremyVN in forum EditingReplies: 4Last Post: 2nd Jul 2022, 18:28 -
How to make keyframe jumps smaller?
By Felow in forum Newbie / General discussionsReplies: 4Last Post: 26th Nov 2020, 00:09 -
Trying to cut the first few seconds of a MP4 video on a non-keyframe
By Cyber Akuma in forum Newbie / General discussionsReplies: 1Last Post: 30th Nov 2018, 21:42 -
request for batch program for "pyscenedetect"
By ujang in forum ProgrammingReplies: 28Last Post: 7th Nov 2018, 15:14 -
VirtualDub2: Force Keyframe every x frames
By ConvertKonvert in forum Newbie / General discussionsReplies: 10Last Post: 24th Sep 2018, 09:15