 |
|
|
05-28-2020, 01:20 PM
|
#1
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
Video thumbnail scripts
REAPER doesn't currently have the option to display video thumbnails in video items, so I uploaded two scripts that offer a (somewhat hackish) workaround:
* js_Video - Extract thumbnails of video items to empty, MIDI or video processor items
This script extracts thumbnail images from selected video items, and adds the thumbnails to selected empty items, MIDI items or dedicated video processor.
These empty/MIDI/processor items can be added manually at hitpoints, or alternatively, empty items can be added by the script "mrlimbic_ffprobe scene detect.lua", which creates empty items at scene (or camera/line) cuts.
(NOTE: For creating a zoom-responsive "thumbnail track", the "Create thumbnail items" script below is much faster than the "Extract thumbnails" script.)
On Linux, ffmpeg needs to be installed, and on WindowsOS and macOS, an ffmpeg executable is required.
* js_Video - Automatically adjust size of thumbnail items when zooming
If thumbnails are extracted and displayed in static empty items, zooming in will result in messy tiling when the items' pixel widths become longer than the width of the thumbnails, while zooming out will result in tiny, barely visible images when the item widths become shorter.
This script offers a workaround: It runs in the background, and automatically adjusts the width of items containing thumbnail images to the approximate width of the images.
All calculations are performed when zooming, not when scrolling, so the script doesn't interfere with playback or recording.
Although this script is mainly intended to create a zoom-responsive "video thumbnail track", it is also useful for preserving the on-screen aspect ratios of other empty items, such as text items or marker items.
EDIT: Third script:
* js_Video - Create thumbnail items in selected track for selected video items
This script creates thumbnail items at regular spacing along the entire lengths of selected video items, and is much faster than the first script, which adds images to pre-existing, irregularly spaced empty items.
Last edited by juliansader; 05-30-2020 at 12:16 PM.
|
|
|
05-28-2020, 05:24 PM
|
#2
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 7,339
|
As long as this isn't native, any workarround is welcome,
and this one seems pretty good ! Well done !
How efficient it is in practice ? Doesn't it take too many CPU power of disk space to generates all the images (let's say, for a 15 minutes video ?)
|
|
|
05-29-2020, 02:05 AM
|
#3
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 2,879
|
On a scale from 1 to 10 thank you 500!!
|
|
|
05-29-2020, 08:05 AM
|
#4
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
Quote:
Originally Posted by X-Raym
How efficient it is in practice ? Doesn't it take too many CPU power of disk space to generates all the images (let's say, for a 15 minutes video ?)
|
It is surprisingly fast and CPU usage and well as disk space are negligible -- but RAM might be a problem for lower-powered DAWs.
On my current project, with a video item about 37 minutes long and one thumbnail per second, it uses almost 7GB RAM. Disk space is less than 100MB since each image is just 20kB. I don't know why RAM usage is so many orders of magnitude larger than disk space. EDIT: RAM problem solved!
A performance tip: lock the height of the thumbnail tracks, to prevent them from being re-calculated every time that you zoom other tracks vertically. (In fact, I think I should update the script to lock the heights automatically.)
Last edited by juliansader; 02-05-2021 at 11:56 AM.
|
|
|
05-29-2020, 08:52 AM
|
#5
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 6,245
|
very clever and cool! even as workaround
a jpg can be 20 KB but I think what matters to REAPER would be the resolution. the total number of decoded pixels. maybe as a thumbnail it doesn't need large images specially if you are going to lock the track height, the images could be resized to that track height too
|
|
|
05-29-2020, 09:35 AM
|
#6
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 7,339
|
@juliansader
Thx for detailes bencharmking.
Indeed is is EXTRA heavy on RAM ! Maybe something to optimized on cockos end ? or maybe in the script Not sure what API functions you use for that... ^^
ANd heda is right maybe the JPEG is decoded and scaled to full rez and it become something larger than 20kn in RAM.
|
|
|
05-29-2020, 09:40 AM
|
#7
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 7,339
|
Maybe there would bea way to only load image in current arrange view section to avoid loading al of them in the ram ? More disk usage but less ram usage ?
(i know it is quite tricky under the hood, not even mure my idea make sense with the way it currently work).
|
|
|
05-29-2020, 02:11 PM
|
#8
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
Quote:
Originally Posted by heda
very clever and cool! even as workaround
a jpg can be 20 KB but I think what matters to REAPER would be the resolution. the total number of decoded pixels. maybe as a thumbnail it doesn't need large images specially if you are going to lock the track height, the images could be resized to that track height too
|
You are correct! When I scale the images to 100p, the RAM usage dropped from 7GB to just 150MB!
I will update the script tomorrow. Instead of asking the user to enter a number for JPG quality, it will ask for thumbnail height, with a default of 100p.
Last edited by juliansader; 05-29-2020 at 02:18 PM.
|
|
|
05-29-2020, 02:14 PM
|
#9
|
Human being with feelings
Join Date: Jul 2009
Posts: 2,492
|
superb work!
|
|
|
05-29-2020, 06:10 PM
|
#10
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 7,339
|
Quote:
, the RAM usage dropped from 7GB to just 150MB!
|
Thats why I call optimization !
|
|
|
05-29-2020, 08:21 PM
|
#11
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
I've added a new script, "js_Video - Create thumbnail items in selected track for selected video items", which creates thumbnail items at regular spacing along the entire lengths of selected video items, and which is much faster than the first script that adds images one-by-one to pre-existing empty items.
|
|
|
05-30-2020, 12:36 AM
|
#12
|
Human being with feelings
Join Date: Jul 2009
Posts: 6,206
|
very interesting script!
|
|
|
05-30-2020, 01:34 AM
|
#13
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 2,879
|
Not sure what I'm doing wrong but I get only single thumbnail(frame) thru all the clip. Only 1 image is created in the folder.
Edit: Installed #1 script, works as expected (was on #3)
Edit2 : sorry other way around #3 works, #1 gets 1 image
Last edited by Sexan; 05-30-2020 at 04:28 AM.
|
|
|
05-30-2020, 03:24 AM
|
#14
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
Quote:
Originally Posted by Sexan
Not sure what I'm doing wrong but I get only single thumbnail(frame) thru all the clip. Only 1 image is created in the folder.
Edit: Installed #1 script, works as expected (was on #3)
|
Could you send me the script's Console output?
|
|
|
05-30-2020, 04:09 AM
|
#15
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 2,879
|
Code:
1 thumbnail items found.
Processing thumbnails:
Done!
Successfully added: 1
Non-overlapping with video items: 0
|
|
|
05-30-2020, 04:16 AM
|
#16
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
Was it script #1 or #3 that didn't work properly for you?
The output that you posted is from script #1, and it only found one empty item, so only one thumbnail will be created. Unlike #3, #1 doesn't create new items, and was originally intended as a companion script to mrlimbic's scene detection script, which performs the item creation.
|
|
|
05-30-2020, 04:24 AM
|
#17
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 2,879
|
Oh, then sorry my bad. I thought you create empty item and it makes all pictures.
This was script #1 (I've also posted wrong above sorry)
Script #3 works fine
|
|
|
05-30-2020, 05:06 AM
|
#18
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 2,879
|
BTW just wondering something, long ago when spectral view was in implementation stage, Xenakios managed somehow to write data into peak files. Is there any API/call from C++ that allows this (adding custom data to peak file)?
https://forum.cockos.com/showpost.ph...&postcount=112
|
|
|
05-30-2020, 05:54 AM
|
#19
|
Human being with feelings
Join Date: Apr 2011
Posts: 2,874
|
Thanks julian! Very nice!
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
|
|
|
05-31-2020, 12:56 AM
|
#20
|
Human being with feelings
Join Date: Oct 2009
Location: France
Posts: 622
|
Thank you so much for looking into this feature.
|
|
|
07-14-2020, 12:08 PM
|
#21
|
Human being with feelings
Join Date: Jan 2012
Posts: 825
|
Does this work on Mac?
It’s asking me to select the folder with the ffmpeg executable.. and then it doesn’t accept me picking the user plugins folder..
|
|
|
07-14-2020, 01:40 PM
|
#22
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
It is supposed to work on Mac. Does your user plugins folder contain the "ffmpeg" (no extension) file?
|
|
|
07-14-2020, 02:06 PM
|
#23
|
Human being with feelings
Join Date: Jan 2012
Posts: 825
|
Hi Julian
It contains ffmpeg with the extension .dylib
What do I do ?
|
|
|
07-14-2020, 02:42 PM
|
#24
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
The dylib file is an extension that REAPER can load, similar to SWS or ReaScriptAPI.
To run these scripts, you need the executable. If I remember correctly, you can get the executable in the "static" build from https://ffmpeg.zeranoe.com/builds/
|
|
|
07-14-2020, 05:05 PM
|
#25
|
Human being with feelings
Join Date: Jan 2012
Posts: 825
|
Aha that seems to work!
Thanks
|
|
|
01-30-2021, 09:08 AM
|
#26
|
Human being with feelings
Join Date: Jun 2020
Posts: 2
|
anyone else getting the error - '...ail items in selected track for selected video items.lua:106: attempt to call a nil value (field 'JS_Dialog_BrowseForFolder')'
?
PS, I find that MrLimbic's scene detect works perfectly when the LUA colourspace threshold is set to 20% in the script
|
|
|
01-30-2021, 12:41 PM
|
#27
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
That error message probably means that the js_ReaScriptAPI extension has not been installed. You can install the extension using ReaPack, or download directly from https://github.com/juliansader/ReaExtensions.
|
|
|
02-04-2021, 11:58 AM
|
#28
|
Human being with feelings
Join Date: Apr 2020
Posts: 385
|
Nice scripts! Can this script:
js_Video - Create thumbnail items in selected track for selected video items
be set up so I have 24 frames per second? And how?
Or actually 23.976!
Last edited by Pink Wool; 02-04-2021 at 12:03 PM.
|
|
|
02-04-2021, 03:40 PM
|
#29
|
Human being with feelings
Join Date: Jul 2009
Posts: 6,206
|
Quote:
Originally Posted by Pink Wool
Nice scripts! Can this script:
js_Video - Create thumbnail items in selected track for selected video items
be set up so I have 24 frames per second? And how?
Or actually 23.976! 
|
doesn't it follow your video settings in Project Settings?
|
|
|
02-05-2021, 01:35 AM
|
#30
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
Quote:
Originally Posted by Pink Wool
Nice scripts! Can this script:
js_Video - Create thumbnail items in selected track for selected video items
be set up so I have 24 frames per second? And how?
Or actually 23.976! 
|
I have uploaded v0.91 of the script, which will accept decimals as thumbnail spacing.
To match with framerate, use a spacing of 1/fps, such as 1/23.976
|
|
|
02-05-2021, 01:38 AM
|
#31
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,455
|
Quote:
Originally Posted by EpicSounds
doesn't it follow your video settings in Project Settings?
|
Not at present. However, if other users also prefer to extract one thumbnail per frame, I can make the default spacing follow fps.
|
|
|
02-06-2021, 07:49 AM
|
#32
|
Human being with feelings
Join Date: Apr 2020
Posts: 385
|
Quote:
Originally Posted by juliansader
I have uploaded v0.91 of the script, which will accept decimals as thumbnail spacing.
To match with framerate, use a spacing of 1/fps, such as 1/23.976
|
Thanks! I'm sure I'll start using this now!
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 08:06 AM.
|