How to screencast to a video file using java? - java

In some situations (automated testing) I need to screencast my display(s) to video file(s), but currently i can only save a series of PNG files using Robot and ImageIO classes, I know there are other third party programs to convert this set of image files into a video file but I want to make it in my code without a need to third party applications, so how to convert from a series of PNG files into a video file in any format ? Thanks in advance.

I would just get FFmpeg and use that to convert your images to video. You can make syscalls in Java if what you mean by "third party application" is "I don't want to do it manually" as FFmpeg supports command-line.
For example, maybe something like
String[] cmds = {"path/to/ffmpeg", args ... }
Runtime.getRuntime().exec(cmds);
There are many tutorials available on how to use ffmpeg to convert a sequence of images to a video file.

Related

Converting .swf files to animated gifs in Java

I have a bunch of banner files in .swf format. I ultimately want to place these inside a pdf using Java. I have been successful in putting jpegs inside a pdf in Java so far.
I want to know the following things:
Is it possible to place the banner files(.swf) in a pdf using either standard java or an external library.
If the above is not possible, is it possible to convert these files into animated gifs(again with standard/external java libraries) and put it in the pdf.
I would atleast like to extract a frame from these .swf files and use it as a jpeg in my PDF.
Some PDF reader may read the swf, like Acrobat, but most won't.
You'd better be converting them.
Here is some external tools that can help you in the process: http://www.swftools.org/
As of making that with native java, it is possible, but it would require re-rendering all the SWF vector drawing, which is a quite heavy work.

automate the creation of video of adobe premiere projects programmatically

I created about 10 different projects in adobe premiere to create video sequences of 4 images with an audio in the background and the text on the images. The duration of the clip is 30 seconds. The problem is that I have to create more than 1,000 videos of different image sequences. I thought about creating a script in C or Java or any other programming language to automate this: in practice the script should copy the images to a folder start the rendering and when finished go to the next slide. I found nothing. Someone knows how to help?
You might want to consider using an entirely commandline-based process instead of trying to use Adobe Premiere. This would allow it to be easily scripted.
FFMpeg is a commandline tool allows you to create a video from a sequence of images -- one image for for each frame of the video. You can also mix-in your audio file with FFMpeg. The hardest step will be generating images that have the proper text superimposed.
For more info on using FFMpeg you can start with an example like this:
https://lukecyca.com/2013/stop-motion-with-ffmpeg.html

Java library to convert InDesign file to image (jpg, png, etc.)

I have a Java webapp that works with InDesign files, I need my application to be able to show a preview of the file and also to send it to the printer. Is there some library that can take the InDesign file and convert it to an image file?
Thanks.
Don't know if you've had any luck with this, but we use imagemagick for this kind of thing. It's not a java library but we access it in java via the command line, and it works really well.

Streaming video files users have uploaded

We have a java web application where users can upload all kinds of files including any kind of video files. Now we want to allow them to stream these video files they own. So I need to make sure that they are the owner and then stream video. Also possibly stream a preview.
Do I need to convert these video files before streaming and where should I look to get started?
The best video playback/encoding library I have ever seen is ffmpeg. It plays everything you throw at it. (It is used by MPlayer.) It is written in C but I found some Java wrappers.
FFMPEG-Java: A Java wrapper around ffmpeg using JNA.
jffmpeg: This one integrates to JMF.

How to distinguish between audio file and video file?

I am using Java to write a media application.
Given a file, how can I know is it a audio file or video file?
By the way, I use vlcj library.
In Java 7 you will be able to use java.nio.file.probeContentType to do this.
In the meantime, there are a number of other options for doing this kind of thing.

Categories