压缩的 mp4 视频播放时间过长 (exoplayer)
Compressed mp4 video is taking too long time to play (exoplayer)
视频(mp4) 从android 摄像头录制并发送到后端,这里我使用ffmpeg 包装器压缩视频[44mb 视频到5.76mb]。压缩效果很好,但是当我发送视频在 android(exo player) 中播放时,启动时间太长。
下面是我要压缩的代码:
FFmpegBuilder builder = new FFmpegBuilder()
.setInput("D:/dummyVideos/myvideo.mp4") // Filename, or a FFmpegProbeResult
.overrideOutputFiles(true) // Override the output if it exists
.addOutput("D:/dummyVideos/myvideo_ffmpeg.mp4") // Filename for the destination
.setFormat("mp4") // Format is inferred from filename, or can be set
.disableSubtitle() // No subtiles
.setAudioChannels(1) // Mono audio
.setAudioCodec("aac") // using the aac codec
.setAudioSampleRate(48_000) // at 48KHz
.setAudioBitRate(32768) // at 32 kbit/s
.setVideoCodec("libx264") // Video using x264
.setVideoFrameRate(24, 1) // at 24 frames per second
.setVideoResolution(1280, 720) // at 640x480 resolution
.setVideoBitRate(762800)
.setStrict(FFmpegBuilder.Strict.EXPERIMENTAL) // Allow FFmpeg to use experimental specs
.done();
谁能告诉我为什么视频在 exo 播放器中播放时间过长?压缩有什么问题吗?
根据我正在写的评论和此处,由于 "moov" 原子视频需要很长时间才能播放,这里是描述的博客:https://rigor.com/blog/2016/01/optimizing-mp4-video-for-fast-streaming
代码是:
try{
QtFastStart.fastStart(inputFile, outputFile); // Adds moov to your input
// Now your output file is ready to stream!
}catch (QtFastStart.MalformedFileException m){
logger.error("QT", m);
}catch (QtFastStart.UnsupportedFileException q){
logger.error("QT", q);
}catch (IOException i){
logger.error("QT", i);
}
视频(mp4) 从android 摄像头录制并发送到后端,这里我使用ffmpeg 包装器压缩视频[44mb 视频到5.76mb]。压缩效果很好,但是当我发送视频在 android(exo player) 中播放时,启动时间太长。
下面是我要压缩的代码:
FFmpegBuilder builder = new FFmpegBuilder()
.setInput("D:/dummyVideos/myvideo.mp4") // Filename, or a FFmpegProbeResult
.overrideOutputFiles(true) // Override the output if it exists
.addOutput("D:/dummyVideos/myvideo_ffmpeg.mp4") // Filename for the destination
.setFormat("mp4") // Format is inferred from filename, or can be set
.disableSubtitle() // No subtiles
.setAudioChannels(1) // Mono audio
.setAudioCodec("aac") // using the aac codec
.setAudioSampleRate(48_000) // at 48KHz
.setAudioBitRate(32768) // at 32 kbit/s
.setVideoCodec("libx264") // Video using x264
.setVideoFrameRate(24, 1) // at 24 frames per second
.setVideoResolution(1280, 720) // at 640x480 resolution
.setVideoBitRate(762800)
.setStrict(FFmpegBuilder.Strict.EXPERIMENTAL) // Allow FFmpeg to use experimental specs
.done();
谁能告诉我为什么视频在 exo 播放器中播放时间过长?压缩有什么问题吗?
根据我正在写的评论和此处,由于 "moov" 原子视频需要很长时间才能播放,这里是描述的博客:https://rigor.com/blog/2016/01/optimizing-mp4-video-for-fast-streaming
代码是:
try{
QtFastStart.fastStart(inputFile, outputFile); // Adds moov to your input
// Now your output file is ready to stream!
}catch (QtFastStart.MalformedFileException m){
logger.error("QT", m);
}catch (QtFastStart.UnsupportedFileException q){
logger.error("QT", q);
}catch (IOException i){
logger.error("QT", i);
}