What is the easiest way to merge two flv videos? - java

what is the easiest way to merge two flv videos into one?
Would be awesome if its possible without command-line-tools like ffmpeg.
It would be great if someone knows a simple java solution =)
(on the server side)

Do you want it server side or client side?
You can simply play one after the other, using a flv player that has a playlist.
You can use avidemux to manualy merge the two
The ffmpeg command for the server side process is really simple:
ffmpeg -i joined.flv -vcodec copy -acodec copy final.flv

According to ffmpeg FAQ:
Some formats allow you to directly
append video data to existing video
files. The easiest would be to use one
of these formats as intermediate
conversions, append files as desired,
and finally convert to format of
choice:
ffmpeg -i input1.avi -sameq intermediate1.mpg
ffmpeg -i input2.avi -sameq intermediate2.mpg
cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
ffmpeg -i intermediate_all.mpg -sameq output.flv
Thanks

I suggest trying avidemux. It understands FLV, is easy to use and you can easily append videos to each other and save them out in the same or different formats.

If you're looking to append two FLV's from Java code, you can find source code (using Xuggler) here.

Related

Receiving and Manipulating RTSP stream using FFMPEG library in Java Application

Hope you all be fine and doing great.
I am currently working on a Java Web Application. I am getting Streaming video using RTSP URL. This URL is like:
rtsp://---.---.---./6ca714ae28e52f31
I have been able to capture video, diplay/listen it and store it in .mp4 file using FFMPEG with the following command:
fmpeg -i rtsp://username:password#---.---.---.---/6ca714ae28e52f31 -f mov e:/bay.mov (with authentication)
Now, I want to achieve the same in my Java application using ffmped library. I am sure if all this possible through commands then It will also be possible using its library. But unfortunately couldn't get any working useful material regarding this on web.
So, I simply want to ask that:
1. How can I fetch Streams using this RTSP URL in my Java Application with FFMPEG library
2. How can I Manipulate this fetched streaming such as start, stop, end etc.
3. How can I store this streaming in media file in playable form in any specified format.
I have found a FFMPEG's Java Rapper JJMPEG. Now I have two options either to issue FFMPEG command to CMD using Java Application or use JJMPEG library directly. Don't know which one will be better choice.
Thanks for your time and considerations.

How to build an mp4 from a set of still images and an audio file in Java

I want to take a few still images and an audio file and turn them into an mp4 file. I am most familiar with java, so that is what I'd prefer to do the coding in. Is there any way to do this, or any library I should look into? I looked at mp4parser, but I couldn't see how to do what I am looking for.
Is there a reason to be doing this in java? Something like ffmpeg can do this, but it's a command line tool.
Well, also a C++ library. I guess there's a Java binding for it, too: https://code.google.com/p/jjmpeg/
For that matter, you could take a look at the ffmpeg source, figure out what they're doing here:
ffmpeg -start_number n -i test_%d.jpg -vcodec mpeg4 test.mp4
Mux in some audio, and you're off. Anyhow, that's how I'd start out. Perhaps someone else will chime in with better specifics.

Saving two streams of one of video and other audio using Xuggler and Red5

I am using a red5 server. I am doing a two way video conference using flex application. My current red5 server is storing both streams as different flv files.
now i have done some editing and have saved these edited files as one with video stream
(OutputVideo.flv)
and one with Audio Stream
(OutputAudio.mp3)
.
Now i want to join these videos into one flv
(Output.flv)
How can i do that using xuggler.
Please if anyone can help me or at least provide me some hints. Note that i am using eclispe java
I am just starting to look into xuggler, so this answer is untested. From this tutorial, it looks like you create a chain of commands:
[...]
// create a tool chain:
// reader -> addStaticImage -> reduceVolume -> writer
mediaReader.addListener(imageMediaTool);
imageMediaTool.addListener(audioVolumeMediaTool);
audioVolumeMediaTool.addListener(mediaWriter);
[...]
These don't have to be the same streams, as I understand it; they just have to be chained. Sorry I am not more help, but hopefully someone can correct any errors.
Check my answer HERE
Can merge audio and video file and the resulting file will be nicely synchronized.

Java: How to read available audio tracks in a video file?

Some video files contain multiple audio tracks. Multiple languages for example. Is there a library which gets information about these audio tracks? Names of the audio tracks would be sufficient.
It should support common formats (mkv, avi,...)
I believe the best monolithic media file library available is that for VLC player. I seem to remember there was a Java wrapper, but it's probably not maintained (like all Java wrappers more than a few weeks old heheh).
I have found a solution to my problem. From Java I call the following command:
ffmpeg -i myvideo.mkv
Then I read the commands output and filter the lines which start with Stream #.
This works on all my files with multiple audio tracks.

media conversion library/plugin preferably php

I am looking for an media conversion library that can convert and compress various media i.e both audio and video files to various formats.
FFMPEG-PHP is a popular choice for extracting information. It doesn't re-encode files, though. http://ffmpeg-php.sourceforge.net/
But if you have an instance of FFMPEG installed on the machine, you can call FFMPEG via the exec function in php.
Eg: exec(’ffmpeg -i ‘.$SourcePath.’ ‘.$Destination);
I think your best bet is ffmpeg-php (can be used for both audio and video conversions). Imagemagick has a few basic video conversion options as well.
A second option would be to use mencoder from the MPlayer project (again, you'll have to call this as a command line tool). The main difference between ffmpeg and MPlayer is that the former comes with open source codecs while the latter comes with a host of codecs from all kinds of sources plus it uses ffmpeg.
So ffmpeg is a little more simple to use, MPlayer can convert between many more formats but the command line gets pretty complex.

Categories