【问题标题】:Android video streaming of mp4 files with MOOV atom at the end最后带有 MOOV atom 的 mp4 文件的 Android 视频流
【发布时间】:2016-06-23 05:24:51
【问题描述】:

我已经实现了一个流式视频播放器,它可以使用 VideoView 和 asynctask 在 Android 中流式传输视频格式,包括 mp4。但是,有些视频从一开始就可以流畅播放,而有些视频直到完全下载后才开始播放。

根据我的研究,我发现带有 moov atom(如 TOC)的 mp4 文件在创建时以这种方式保存在文件末尾。

我见过一个可以解决这个问题的库。

compile 'net.ypresto.qtfaststartjava:qtfaststart:0.1.0'

但是我没有得到任何关于如何将此库整合到我的项目中的参考。请发布一些参考资料或 sn-ps 来实现这个库来解决我的问题。

【问题讨论】:

  • 您找到解决方案了吗?
  • 很遗憾,不!我已经让这些视频完全下载和流式传输。

标签: android implementation qt-faststart


【解决方案1】:
    File input = new File(path + "/input.mp4"); // Your input file
    File output = new File(path + "/output.mp4"); // Your output file
    try{
        if(!output.exists()) // if there is no output file we'll create one
            output.createNewFile();
        }
    }catch (IOException e){
        Log.e("TAG", e.toString());
    }

    try{
        QtFastStart.fastStart(input, output);
    }catch (QtFastStart.MalformedFileException m){
        Log.e("QT", m.toString());
    }catch (QtFastStart.UnsupportedFileException q){
        Log.e("QT", q.toString());
    }catch (IOException i){
        Log.e("QT", i.toString());
    }

就是这样

【讨论】:

    猜你喜欢
    • 2022-08-04
    • 1970-01-01
    • 2013-11-17
    • 1970-01-01
    • 2012-07-16
    • 1970-01-01
    • 2015-05-09
    • 2015-10-04
    相关资源
    最近更新 更多