ffmpeg video format conversion

 

Recently, the synchronous playback function of website video has been developed. It needs to support all video formats to be converted into web page recognition formats. Currently, MP4 and ogv formats are basically compatible with major browsers. The following code is used to convert video formats by calling ffmpeg.exe under cmd.

 

--mp4
ffmpeg.exe -i a.mp4 -g 30 -s 800x600 b.mp4

--ogv
ffmpeg.exe -y -i a.ogv -b 1500k -vcodec libtheora -acodec libvorbis -ab 160000 -g 30 -s 800x600 b.ogv


 

    Note that when using java calls, do not try to use the output stream to read the conversion progress, otherwise it will cause the conversion to freeze all the time. The current method is to regularly judge the size of the file. If the size of the file does not change within a period of time, the conversion is complete (currently I can't think of a better way for now)

 

If the attachment is larger than 10M, it cannot be uploaded. Please search and download by yourself. Pay attention to downloading the new version. If you use the old version, the conversion will fail.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326678582&siteId=291194637