Add source for video files#698
Conversation
Currently only supports .mp4
Codecov Report
@@ Coverage Diff @@
## master #698 +/- ##
============================================
- Coverage 52.45% 51.43% -1.02%
- Complexity 0 1146 +1146
============================================
Files 240 247 +7
Lines 7708 7955 +247
Branches 522 539 +17
============================================
+ Hits 4043 4092 +49
- Misses 3480 3678 +198
Partials 185 185Continue to review full report at Codecov.
|
| eventBus.post(new SourceHasPendingUpdateEvent(VideoFileSource.this)); | ||
| Thread.sleep((long) (1e3 / fps)); | ||
| } catch (InterruptedException | FrameGrabber.Exception e) { | ||
| getExceptionWitness().flagException(e); |
There was a problem hiding this comment.
Handle the InterruptedException like an InterruptedException should be handled.
http://www.yegor256.com/2015/10/20/interrupted-exception.html
|
I don't know if/when this will get merged but I'm very interested in using video files for testing pipelines instead of static images. |
| getExceptionWitness().flagException(e); | ||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| getExceptionWitness().flagException(e, "Interrupted while waiting for next frame"); |
There was a problem hiding this comment.
You probably don't want to flag and you probably want to exit the while loop.
| * A source for a video file input. | ||
| */ | ||
| @XStreamAlias("grip:VideoFile") | ||
| public class VideoFileSource extends Source { |
There was a problem hiding this comment.
There seems to be duplicate code between this and the Camera source. Can any of that be refactored into a base class?
Also, I notice you are using a thread. We had issues with threads and their weirdness. Any reason you didn't implement this as a restarting service?
There was a problem hiding this comment.
There are some fundamental differences between them. Camera frame grabbers don't get null frame mats from the conversion; video files do. The grabber for the video file needs to update at a specific rate specified by the file itself; camera sources just grab as fast as possible.
And I'm using a Thread (scheduled executor now) to grab the frames because of these two issues.
Should keep the FPS steady. Also allows it to be paused by external controls if they get added.
|
Can you rewind or perhaps restart the video? |
|
@JLLeitschuh scope creep
…On Thu, Mar 9, 2017 at 11:32 AM Jonathan Leitschuh ***@***.***> wrote:
Can you rewind or perhaps restart the video?
What about advancing one frame at a time? Would either of these features
be useful?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#698 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAORVwePp1vlb9LFCpTUMxFZsOjrsX_Xks5rkCmNgaJpZM4Kmn4n>
.
|
|
That is something that would be worthwhile to include. It would act similar to the multi-image file source, but with a scrubber and play/pause button as well. |
Also adds a basic observable framework because JavaFX's observables aren't available to the core module.
|
There's something weird with the FFMpegFrameGrabber where it'll segfault, seemingly at random. Seems to only happen when scrubbing through a long video?
I only have a ~7MB mpeg file though, maybe a smaller one would work better. Edit: the size doesn't seem to matter, I can use a 20MB mpeg just fine. Might just be a corrupt or poorly encoded file that's causing the problems. |
|
Seems like you are re-inventing the wheel here: This library also provides synchronization guarantees. |
|
I wanted to keep it similar to JavaFX's Observables |
|
Do you want to provide any synchronization guarantees about adding/removing observers? |
|
There are in |
|
Are you sure you don't want to just use RX java's observable? |
JLLeitschuh
left a comment
There was a problem hiding this comment.
This looks good. Merge away.
Currently supports: