Giter Site home page Giter Site logo

demo-m3u8's Introduction

demo-m3u8

mp4转m3u8 demo 本项目主要是mp4转m3u8相关调用

为了在网站上传后能够实时查询视频转换状态,以此写本demo。 上传后,可以循环调用查询状态接口,当状态是成功,表示转换成功,提示用户消息。

如何使用:

  1. 修改配置文件application.yml:
    • 修改mp4文件和输出保存m3u8的位置:
      video:
      #mp4视频文件
        source: E:\test\video2.mp4
      #  转换输出路径:必须是xxx\xx.m3u8,否则可能会报错
        target: E:\test\video2.m3u8
      
    • 修改ffmpeg执行路径: 如果已经有了环境变量可以不用配置,否则必须指定ffmpeg具体路径
      # ffmpeg命令:不配置或ffmpeg,必须保证ffmpeg已经加了环境变量,否则需要指定ffmpeg路径:/usr/local/bin/ffmpeg或D:\\!Soft\\ffmpeg-20181127-1035206-win64-static\\bin\\ffmpeg.exe
      ffmpeg: ffmpeg
      
  2. 启动springboot
  3. 访问http://localhost:8080/video 返回以下字样表示启动成功。 hello, I'm skyjilygao
  4. 开始转换: http://localhost:8080/video/start
  5. 转换状态: http://localhost:8080/video/status
  6. 停止转换: http://localhost:8080/video/stop

转换好了如何访问:

  1. 将转换好的m3u8和ts文件放在resource/static/t目录下(我这里是t下,也可以直接放在static下。只要保证能访问到即可)
  2. 修改index.html,修改source标签src属性 <source src="http://localhost:8080/t/video2.m3u8" type="application/x-mpegURL">
  3. 播放:http://localhost:8080

demo-m3u8's People

Contributors

skyjilygao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.