Old 05-28-2020, 01:20 PM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default 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.
juliansader is online now   Reply With Quote
Old 05-28-2020, 05:24 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 7,339
Default

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 ?)
X-Raym is offline   Reply With Quote
Old 05-29-2020, 02:05 AM   #3
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,879
Default

On a scale from 1 to 10 thank you 500!!
Sexan is offline   Reply With Quote
Old 05-29-2020, 08:05 AM   #4
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default

Quote:
Originally Posted by X-Raym View Post
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.
juliansader is online now   Reply With Quote
Old 05-29-2020, 08:52 AM   #5
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 6,245
Default

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
heda is offline   Reply With Quote
Old 05-29-2020, 09:35 AM   #6
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 7,339
Default

@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.
X-Raym is offline   Reply With Quote
Old 05-29-2020, 09:40 AM   #7
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 7,339
Default

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).
X-Raym is offline   Reply With Quote
Old 05-29-2020, 02:11 PM   #8
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default

Quote:
Originally Posted by heda View Post
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.
juliansader is online now   Reply With Quote
Old 05-29-2020, 02:14 PM   #9
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,492
Default

superb work!
__________________
PLEASE Devs: "FX-Container" --> https://forum.cockos.com/showthread.php?t=226533
Reflected is offline   Reply With Quote
Old 05-29-2020, 06:10 PM   #10
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 7,339
Default

Quote:
, the RAM usage dropped from 7GB to just 150MB!

Thats why I call optimization !
X-Raym is offline   Reply With Quote
Old 05-29-2020, 08:21 PM   #11
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default

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.
juliansader is online now   Reply With Quote
Old 05-30-2020, 12:36 AM   #12
EpicSounds
Human being with feelings
 
EpicSounds's Avatar
 
Join Date: Jul 2009
Posts: 6,206
Default

very interesting script!
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog
EpicSounds is online now   Reply With Quote
Old 05-30-2020, 01:34 AM   #13
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,879
Default

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.
Sexan is offline   Reply With Quote
Old 05-30-2020, 03:24 AM   #14
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default

Quote:
Originally Posted by Sexan View Post
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?
juliansader is online now   Reply With Quote
Old 05-30-2020, 04:09 AM   #15
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,879
Default

Code:

1 thumbnail items found.

Processing thumbnails:

Done!

Successfully added: 1
Non-overlapping with video items: 0
Sexan is offline   Reply With Quote
Old 05-30-2020, 04:16 AM   #16
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default

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.
juliansader is online now   Reply With Quote
Old 05-30-2020, 04:24 AM   #17
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,879
Default

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
Sexan is offline   Reply With Quote
Old 05-30-2020, 05:06 AM   #18
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,879
Default

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
Sexan is offline   Reply With Quote
Old 05-30-2020, 05:54 AM   #19
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 2,874
Default

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! :)
amagalma is offline   Reply With Quote
Old 05-31-2020, 12:56 AM   #20
Sumalc
Human being with feelings
 
Join Date: Oct 2009
Location: France
Posts: 622
Default

Thank you so much for looking into this feature.
Sumalc is offline   Reply With Quote
Old 07-14-2020, 12:08 PM   #21
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 825
Default

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..
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 07-14-2020, 01:40 PM   #22
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default

It is supposed to work on Mac. Does your user plugins folder contain the "ffmpeg" (no extension) file?
juliansader is online now   Reply With Quote
Old 07-14-2020, 02:06 PM   #23
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 825
Default

Hi Julian
It contains ffmpeg with the extension .dylib
What do I do ?
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 07-14-2020, 02:42 PM   #24
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default

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/
juliansader is online now   Reply With Quote
Old 07-14-2020, 05:05 PM   #25
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 825
Default

Aha that seems to work!

Thanks
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 01-30-2021, 09:08 AM   #26
magrotten
Human being with feelings
 
Join Date: Jun 2020
Posts: 2
Default

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
magrotten is offline   Reply With Quote
Old 01-30-2021, 12:41 PM   #27
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default

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.
juliansader is online now   Reply With Quote
Old 02-04-2021, 11:58 AM   #28
Pink Wool
Human being with feelings
 
Pink Wool's Avatar
 
Join Date: Apr 2020
Posts: 385
Default

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.
Pink Wool is offline   Reply With Quote
Old 02-04-2021, 03:40 PM   #29
EpicSounds
Human being with feelings
 
EpicSounds's Avatar
 
Join Date: Jul 2009
Posts: 6,206
Default

Quote:
Originally Posted by Pink Wool View Post
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?
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog
EpicSounds is online now   Reply With Quote
Old 02-05-2021, 01:35 AM   #30
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default

Quote:
Originally Posted by Pink Wool View Post
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
juliansader is online now   Reply With Quote
Old 02-05-2021, 01:38 AM   #31
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,455
Default

Quote:
Originally Posted by EpicSounds View Post
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.
juliansader is online now   Reply With Quote
Old 02-06-2021, 07:49 AM   #32
Pink Wool
Human being with feelings
 
Pink Wool's Avatar
 
Join Date: Apr 2020
Posts: 385
Default

Quote:
Originally Posted by juliansader View Post
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!
Pink Wool is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.