java中的MP4视频压缩程序

java中的MP4视频压缩程序,java,compression,mp4,video-compression,Java,Compression,Mp4,Video Compression,谁能给我推荐一个好的压缩程序或第三方库来压缩服务器端的MP4视频(我使用的是SpringMVC) 我了解了FFMPEG和Xugler,除此之外,还了解了java中使用的任何维护的压缩器。。请给我一些建议或链接 看看jcodec 它具有H.264主配置文件解码器和H.264基线配置文件编码器,以及MP4 muxer/demuxer支持 也可以考虑基于OS- C的解决方案,尝试一个C->java转换器。这可能是一项非常困难的任务,但是会有很多好的lib。使用FFMPEG包装来压缩视频。 以下是下载

谁能给我推荐一个好的压缩程序或第三方库来压缩服务器端的MP4视频(我使用的是SpringMVC)


我了解了FFMPEG和Xugler,除此之外,还了解了java中使用的任何维护的压缩器。。请给我一些建议或链接

看看jcodec

它具有H.264主配置文件解码器和H.264基线配置文件编码器,以及MP4 muxer/demuxer支持


也可以考虑基于OS- C的解决方案,尝试一个C->java转换器。这可能是一项非常困难的任务,但是会有很多好的lib。

使用FFMPEG包装来压缩视频。 以下是下载链接:

github:

代码如下:

ffmpeg = new FFmpeg("D:/ffmpeg-20180429-cae6f80-win32-static/ffmpeg-20180429-cae6f80-win32-static/bin/ffmpeg");
ffprobe = new FFprobe("D:/ffmpeg-20180429-cae6f80-win32-static/ffmpeg-20180429-cae6f80-win32-static/bin/ffprobe");

FFmpegBuilder builder = new FFmpegBuilder()
                                 .setInput(input)     // Filename, or a FFmpegProbeResult
                                 .overrideOutputFiles(true) // Override the output if it exists
                                 .addOutput(output)   // Filename for the destination
                                 .setFormat("mp4")       // Format is inferred from filename, or can be set
                             //  .setTargetSize(250_000) // Aim for a 250KB file
                                 .disableSubtitle()       // No subtiles
                                 .setAudioChannels(1)                   // Mono audio
                             //  .setAudioChannels(2)
                                 .setAudioCodec("aac")       // using the aac codec
                                 .setAudioSampleRate(48_000) // at 48KHz
                                 .setAudioBitRate(32768)     // at 32 kbit/s
                             //  .setAudioBitRate(126000)
                                 .setVideoCodec("libx264")     // Video using x264             
                                 .setVideoFrameRate(24, 1)     // at 24 frames per second
                                 .setVideoResolution(1280, 720) // at 640x480 resolution
                        //       .setVideoResolution(1024, 768)
                        //       .setVideoResolution(640, 480)
                                 .setVideoBitRate(762800)  
                                 .setStrict(FFmpegBuilder.Strict.EXPERIMENTAL) // Allow FFmpeg to use experimental specs
                                 .done();
     FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);         
     executor.createJob(builder).run(); // Run a one-pass encode

FFMPEG是一款开源且有很好文档记录的视频编码器,它有h264和h265视频编码器,因此您也可以选择适合您需求的编码器。更多信息()FFMPEG安装指南()谢谢您的回复。我将浏览你推荐的链接。欢迎你推荐FFMPEG,因为rest非常容易使用,这取决于你的选择。你有任何示例链接吗?如果您有,请在这里发布。正如您在项目的GitHub页面上看到的,最新提交于2018年3月15日完成。所以是的,它似乎没有死。FFMPEG的最后一次承诺是在4月26日,2018@MikhailKholodkov没有压缩的例子,我也在谷歌上搜索过。你能给我发送示例链接(jcodec)吗?你需要使用SequenceEncoder类。我没有关于这个主题的示例,但现在在Stackoverflow上搜索SequenceEncoder。这可能会有帮助