Notes on eventual video display sync during analysis

Well, it appears there's no really good way to do this here. This will contain various bits of code used to support the fusor, which presently includes everything from embedded 8 bit uP code to stuff to run under Linux in some HLL (often perl) to interface-specific stuff for commercial hardware, sysadmin tips and setups, and running on whatever machines I have in the tree here. So any one piece might fit some other category too, but...there's no pigeon-holing even computer science without losing the app-specific stuff and inter-relations of it all in a specific usage.
Forum rules
Code sharing for fusor data aq and control software

Notes on eventual video display sync during analysis

Postby Doug Coulter » Fri Jun 07, 2019 10:21 am

Well, I always wanted to be able to do this:
I have plots from the database working. We have video from (usually) two cameras, one pointed inside the tank, another pointed at a big screen scope display for the 4ch 2.5 ghz DSO. Can add more cameras easily (they are pi cameras). We're also recording audio via a Blue Yeti stereo mic. The videos at least at "clapboarded" at the beginning - there's a led in their fields of view that blinks at the data aq start time (which helps me know when start is, but is useless if any of them drop frames, which was at one time a problem - hint - usb sticks, nope. SSD on adapter, good, and for low bitrate like the tank - sd card is fine).

At any rate, now and then something "interesting" happens, and the goal would be to get the data from just a few seconds around "that event" and loop play it all together while the lowly human
does what the humans can do that computers stink at - figure out what it means.

So far, all we've had is the ability to find some seconds after a start, and then seek various things out there and examine them, but it's clunky as heck to get say, VLC on the right spot, hard to restart - once is never enough to really see what happened...it was inadequate by most any measure.

Well, it turns out there are command line tools to grab little segments out of videos - a non trivial problem with formats that use keyframes - and audio files, and loop play them.
So, it's possible. Right now the only thing I want I can't figure out how to do is get that time from gnuplot while I'm mousing around inside a plot - it's displayed in a corner of the plot, but...we're back to typing. Wouldn't it be cool to just be able to click-drag to the zone of interest? Well, maybe I'm dreaming, but I did find out how to get the video displays I want programmatically.

I took some notes on a local version of phpbb I keep here, but why not share? I haven't written code for this yet - but it's a good thing my language of choice was designed to be glue and start and control other processes....

Here's my notes so far.
/////////////////////////////////////////////////
From: https://askubuntu.com/questions/59383/e ... ne-command

Example - works kinda quick but skips till next keyframe and outputs poorly viewable video -:
ffmpeg -i source.mp4 -ss 00:00:05 -t 00:00:10 -c copy cut_video.mp4

ffmpeg -i source.mp4 -ss 00:00:05 -t 00:00:10 -async 1 -strict -2 cut_video.mp4
works but is slow. Command without strict re-encoding skips till next keyframe to begin...


///////////////////////////////////////////////////////////////////// THIS THIS THIS
This works better and is fast. From: https://stackoverflow.com/questions/184 ... ing-ffmpeg
ffmpeg -ss 00:01:46 -i testinput.mp4 -to 00:00:10 -c copy output.mp4

The change of one parameter from -t to -to is subtle but is the key here (pun intentional).

################################### playing it
Super simple player comes with ffmpeg, no frills, easy to control from another program
If you set size ratio wrong you get some black on a border.
without -autoexit, it plays the last frame forever.

ffplay -x 300 -y 300 -loop 5 -autoexit output.mp4
repeats 5 times and disappears. There are other options to end on key or mouse press

man2pdf rocks...I need to get that to Bill.


This is all pretty quick on a 7th gen i5 NUC (Basically a laptop version of that cpu). Should be quicker yet if I make files in /tmp and map that over ram...or just make a ramdisk.
Little 10 second videos aren't huge eaters of bits. Maybe 3-10 megabytes depending. The in-tank videos are very compressible - not much changes frame to frame other than the X ray sparkles.
The scope vids are another story... and audio for 10 seconds can't be bad, even as .flac.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Return to Fusor support

Who is online

Users browsing this forum: No registered users and 7 guests