Java Video Solutions

Source: Internet
Author: User
Tags flv file

Solution One:
Java calls FFmpeg perform video conversion
Ffmpeg.exe can parse the format: (asx,asf,mpg,wmv,3gp,mp4,mov,avi,flv, etc.)
For Ffmpeg.exe unresolved file formats (WMV9,RM,RMVB, etc.),
You can use other tools (MEncoder) to convert to AVI (FFmpeg can parse) format;
Mencoder.exe;drv43260.dll;pncrt.dll These 3 files are for file format (WMV9,RM,RMVB etc.)
Convert to AVI (FFmpeg can parse) format prepared, and then convert the converted AVI file into FLV format video file Ffmpeg.exe ...
Cons: To install a third party thing, trouble

Solution II
With JMF. Before programming, you need to install JMF. Trouble
And JMF does not support all platforms

MEncoder can convert video directly to FLV.

Quite a long time did not write blog, changed the new job is a busy is a reason. The most recent job is to make a material management system, which has a requirement to do a video preview, convert the user's uploaded video and preview it on the page. Watching videos on the web, most video sites now use FLV streaming files, which are played by Flash players, and we use this approach. The process is probably the main: User upload files, background conversion file into FLV format->flv player call flv file.
Convert video, audio files to FLV format can use MEncoder or ffmpeg, we adopted the mencoder, installation reference on Linux here, install the end of the setting environment variable: Export ld_library_path=/usr/ Local/lib:ld_library_path
Java is called by process:

Process Process=runtime.exec (cmd);


MEncoder convert video audio into FLV command:
MEncoder source file-o destination file. flv-of lavf-lavfopts I_CERTIFY_THAT_MY_VIDEO_STREAM_DOES_NOT_USE_B_FRAMES-OAC mp3lame-lameopts ABR:BR=56-OVC lavc-lavcopts Vcodec=flv:vbitrate=400:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:dia=4:cmp=6:vb_strategy =1-VF Scale=200:-3-ofps 12-srate 22050

To take video meta-Information commands (video bitrate, length and width information):
Mplayer-identify file name-ao null-vo null-frames 0

Cutting Video commands:
Mencoder-ss start time-OAC copy-ovc copy-endpos end time file name-o destination file name

Working with FLV files (giving video information, cutting, and so on) can be flvtool2.

It is important to note that the standard output and standard error output must be handled by Java calls, otherwise the process will hang at that end and can open a thread to take care of it. In the Web page playback, you can consider using this player, the specific parameters to see its description. The last problem, IE6 Flash control needs to be activated, this problem can be solved by swfobject.js.
Interested bosses can consider themselves to set up a "Tudou", maybe one day to take the VC .... Clouds

Java Video Solutions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.