Saving part of a video with FFmpeg using C - java

I am creating a simple video editing application using Java, JNI, C, and FFmpeg. The UI is being designed in Java and I am talking with FFmpeg from a C file using JNI. Does anyone have any suggestions as to the best way I should go about saving part of a video file using FFmpeg? I am allowing the users to choose parts of the video to save and what I am thinking as of right now is to basically loop through all of the packets and decode each frame (if need to encode to a different format) then save the frame to a file. All the while seeking to different parts of the video based on the users start and stop sections of their crops. If this doesn't make sense I would be glad to clear it up. Any ideas are much appreciated as I am just looking to create the most efficient and correct way to go about doing this. Thanks!

Use xuggler? It will do all for you without you having to figure out the jni bindings.

Related

Linking Website form progress data to GIS

We are trying to develop a website for tracking the progress of pipeline and assets. I want to link progress data entered from forms developed in Java to GIS. We will be capturing all the lat and longs of pipeline stretch and lat and log of progress of work.
I need help in developing shapefile dynamically based on the progress and also to view that shape file in my webpage
The javascript API does have functionality for uploading shapefiles form your desktop into the browser, but you will need another tool to create those shapefiles based on the progress.
For uploading the shapefiles, see the example here: https://developers.arcgis.com/javascript/3/jssamples/portal_addshapefile.html
There may be more examples available at https://developers.arcgis.com/javascript/3/.
For creating the shapefiles dynamically, you could use ArcMap or ArcPro if you have those, or one of many python libraries to help write shapefiles. There may even be some Java libraries to help with this as well but I only work on the front end so I cannot help you there.
For something simple in context, the complexity of what kind of workflow to best suite your needs can range depending on these questions (and probably others I'm not thinking of):
Do you absolutely need to create a shapefile for this? Why can't you just push the form to a spatial database (e.g. PostGIS) and then return the XYs of the points or the string of XYs for line features, etc.?
Where is the source of the data & what is the format? Is it a PDF, text on an HTML page, a .csv file downloadable from a page, etc.? You may need to implement scraping (from a site) or download and update, or your data could be live streaming - these are all different workflows and you need to establish these boundaries before setting up your workflow.
If your end game are points, all you need is XYs in a table format to display in GIS software. If they are lines or polygons, it'd be a little different. Again - what output type are they and what are you trying to do with it (e.g. import into QGIS)?
Without these answers, it doesn't make sense for anyone to suggest something to you that could be totally impossible for you to execute. Please answer these and think through your workflow from beginning to end and/or visa versa.
Cheers,
Shawn

Java Desktop Capture

I want to continuously capture the entire desktop inside of a java application. As I'm capturing, I'd like to chunk the stream of data into small video files (mp4, WebM) for storage. From my research, it would seem that the Robot Java class and the FFmpeg tool are my best options. However, Robot seems to best-fit the use case of obtaining images, not videos. FFmpeg seems like it may support this, but I've struggled to find definitive documentation. I'm looking to emulate what can be done through Chrome's getUserMedia and desktopCapture APIs along with the MediaStreamRecorder JavaScript library. Does anyone have a suggestion for a similar and elegant solution in Java?

Basic image manipulation (open, copy, crop, paste) in Java or Android

I'm creating an android apps that use basic image manipulation (open image,copy, crop, paste).
Basically, the program will have multiple image input and it will be manipulated(copy, crop, paste). Then, an output image will be saved. I had done this in python using PIL library and would like to do the same using Java.
So, how do i do this in? Can someone point me a good library that have all the features? Thanks.
Hope this makes your work on this easy. I was going through some links and found this.
Let me know if you need anything else. Thanks.Image Manipulation in Java

How to use Java to process Webcam data as Image immediately in Webpage

So I have a webpage. I want to catch a webcam data and processing the image I get from that. I thought I could get the image from webcam with WebRTC in javascript. The thing is that, the library I found most suitable with the image processing I need is in Java. It reads an image and do the processing.
How do I combine this? Get image from webcam using WebRTC in javascript and processing it using Java? Or is there any other way to do this?
If my question's wrong, please tell me why. If you think I ask this in a wrong site, please also tell me where I should ask this. Thank you.
Note
As I'm new to web programming, searching and searching, I found that the practice is to execute JSP in server. But what if I have to process the image continously? Won't it be so slow since I would have to send the data continously? Though, in this case, I just need to practice it locally, not in real server. But, is there any way to execute Java in browser?
You can capture individual images over a period of time utilizing a WebRTC recording Javascript library. You can then send the images or the blob down over a websocket to your Java websocket server and process the images.
Check this out, this should pretty much give you all the tools you need to do exactly what you want to do.

Java: Make an animation/video from frames

Howdy! For a research project (in Java), I've got to find some way to save an animation of a graph into some file format. Now I've already got the program working fine drawing each frame. The problem is, short of learning the whole GIF or AVI file format, I have no idea how to assemble the frames programmatically into some sort of animation or video file. File formats don't really matter--input or output. I just need some way to put the frames together and save!
Right now I'm thinking the easiest format would be either animated GIF or AVI. Again, though, it really doesn't matter so long as it works.
Thanks a bunch!
They might not be the best options, but I just thought of these:
You might be able to use some QuickTime APIs. I know they're used fairly often for webcam input, and that they can also generate video.
You could also generate each frame and then assemble them with ffmpeg.
Try Xuggler -- it'll let you save graphics into pretty much any video format.

Categories