Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER for Video Editing/Mangling

Reply
 
Thread Tools Display Modes
Old 12-20-2020, 12:50 PM   #1
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default Auto Switch - slide shows, cycle through videos (Update: Now includes Trigger Switch)

IDK how useful this is in real life, but if nothing else it's a quick way to make slideshows. It steps (and cycles) through every video track below the one where you place it at a rate you can set in frames. You can set a maximum number of tracks for it to look at, and can tell it to skip N tracks. It's supposed to and appears to be deterministic, so that it always shows the same track at any given project/item time even with complex ratios of depth vs skip. Let me know if you have problems with that, but in my fairly quick tests, it seems to work.


Code:
// Auto Switch 
// License: public domain
//hacked by ashcat_lt

//@param 1:interval "interval (frames)" 60 1 1800 900 1
//@param 2:depth "Max Track Depth (0=all)" 0 0 16 8 1
//@param 3:skip "Skip N Tracks" 0 0 16 8 1




depth = depth == 0 ? 639 : depth;
Ntracks = floor(min(depth,input_track_count())); // Number of video files

 gfx_set(0);
 gfx_fillrect(0,0,project_w,project_h);
 x=0; // Counter for looping
 Ntracks > 0 // If there are video tracks
 ?
 count_tracks = ceil(Ntracks / (skip+1)) // Number of grid locations
 : //else
 count_tracks = 0
 ;
current = (skip+1) * (floor(time * framerate / interval) % count_tracks);



gfx_blit (input_track(current));

Last edited by ashcat_lt; 04-07-2021 at 10:05 AM.
ashcat_lt is offline   Reply With Quote
Old 12-20-2020, 11:11 PM   #2
lachinhan
Human being with feelings
 
lachinhan's Avatar
 
Join Date: Nov 2014
Location: Can Tho - Viet Nam
Posts: 305
Default

Thank you so much. I like it
__________________
NK Recording Studio
Email: lachinhan@gmail.com or admin@thuamninhkieu.com
Website:nkpro.top and ntmusicpro.com
lachinhan is offline   Reply With Quote
Old 04-06-2021, 02:19 PM   #3
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Updated version includes a fade time as a percentage of the total interval time


Code:
// Auto Switch 
// License: public domain
//hacked by ashcat_lt

//@param 1:interval "interval (frames)" 60 1 1800 900 1
//@param 2:depth "Max Track Depth (0=all)" 0 0 16 8 1
//@param 3:skip "Skip N Tracks" 0 0 16 8 1
//@param 4:fade "fade (% of interval)" 30 0 100 50 1




depth = depth == 0 ? 639 : depth;
Ntracks = floor(min(depth,input_track_count())); // Number of video files
fade = interval * fade / 100;
da = 1 / fade;
time == 0 ? oldcurrent = current;

 gfx_set(0);
 gfx_fillrect(0,0,project_w,project_h);
 x=0; // Counter for looping
 Ntracks > 0 // If there are video tracks
 ?
 count_tracks = ceil(Ntracks / (skip+1)) // Number of grid locations
 : //else
 count_tracks = 0
 ;
 last = current; 
current = (skip+1) * (floor(time * framerate / interval) % count_tracks);
current != last ? (i = 0; oldcurrent = last;);
gfx_a = 1;
gfx_blit (input_track(oldcurrent));
gfx_a = i;
gfx_mode = 0;
gfx_blit (input_track(current));

i = min (1, (i+da));

Last edited by ashcat_lt; 04-06-2021 at 02:38 PM.
ashcat_lt is offline   Reply With Quote
Old 04-06-2021, 06:31 PM   #4
Spirit
Human being with feelings
 
Join Date: Jul 2008
Location: MotherDiskLand
Posts: 160
Default

This is very timely! But I don't quite understand what numbers to plug in. If I wanted it to continually switch between two tracks every 2 bars, where do the numbers go?
thanks
Spirit is offline   Reply With Quote
Old 04-06-2021, 06:56 PM   #5
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Well, you'd want to figure out how many frames equal two bars and set interval to that number, set max track depth to 2 (or more, if those are the only two video tracks in the project, it doesn't matter), leave skip at 0, and set fade time to taste.

Make sure to put the videos you want to switch between on their own separate tracks, then put this on a third track above those, and make sure the videos/pictures last the whole time.

Edit - Then let me know how it turns out!!!

PPS - But honestly, I'm not going to promise you that it's going to sync very well unless your tempo happens to be an even multiple of frames. I do have an idea for a sort of triggered version of this, which would probably work better.

Last edited by ashcat_lt; 04-06-2021 at 07:16 PM.
ashcat_lt is offline   Reply With Quote
Old 04-07-2021, 02:58 AM   #6
Spirit
Human being with feelings
 
Join Date: Jul 2008
Location: MotherDiskLand
Posts: 160
Default

Excellent, thanks, I'll report back.
Spirit is offline   Reply With Quote
Old 04-07-2021, 10:04 AM   #7
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Here's one that is triggered rather than being time based. It will switch every time the trigger knob goes from 0 to 1. Automate that to match your tempo, and it should sync up pretty flawlessly. This one can't give you a deterministic output unless it actually starts playing from time 0, but there is a knob to reset the sequence back to the first track. It works like the trigger, switching back to input track 0 when the knob goes from 0 to 1.



Code:
// Trigger Switch 
// License: public domain
//hacked by ashcat_lt

//@param 1:trigger "trigger" 0 0 1 0.5 1
//@param 2:depth "Max Track Depth (0=all)" 0 0 16 8 1
//@param 3:skip "Skip N Tracks" 0 0 16 8 1
//@param 4:fade "fade (frames)" 10 0 1800 900 1
//@param 5:reset "reset" 0 0 1 0.5 1



trigger = floor(trigger);
reset = floor(reset);
depth = depth == 0 ? 639 : depth;
Ntracks = floor(min(depth,input_track_count())); // Number of video files
fade = fade;
da = 1 / fade;
time == 0 ? oldcurrent = current=0;
reset > last_reset ? oldcurrent = current=0;
last_reset = reset;

 gfx_set(0);
 gfx_fillrect(0,0,project_w,project_h);
 x=0; // Counter for looping
 Ntracks > 0 // If there are video tracks
 ?
 count_tracks = ceil(Ntracks / (skip+1)) // Number of grid locations
 : //else
 count_tracks = 0
 ;

trigger > last_trigger ? 
  current = (current + skip + 1) % count_tracks;
last_trigger = trigger;
current != last ? (i = 0; oldcurrent = last;);
gfx_a = 1;
gfx_blit (input_track(oldcurrent));
gfx_a = i;
gfx_mode = 0;
gfx_blit (input_track(current));

i = min (1, (i+da));
last = current;

Last edited by ashcat_lt; 04-07-2021 at 10:17 AM.
ashcat_lt 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 05:18 AM.


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