Giter Site home page Giter Site logo

video2hls's Introduction

video2hls

A simple tool to convert a video to a set of files to play it using HLS. HLS is an adaptive bitrate streaming protocol: the video is sliced in small chunks and made available at a variety of different bit rates. Depending on current network conditions, the player automatically selects the appropriate bitrate to download the next segment.

The script needs Python 3.6 and you can run it with --help to get more information about it.

Some browsers may not support natively HLS. In this case, one can use hls.js to get appropriate support. Many video players also support this format. See this blog post for more information.

Examples

Convert using default parameters (MPEG2-TS with many resolutions):

./video2hls TearsOfSteel.mp4

Add an overlay to distinguish the different resolutions:

./video2hls --mp4-overlay '{resolution}p, progressive' --video-overlay '{resolution}p, HLS' \
   TearsOfSteel.mp4

Use fragmented MP4:

./video2hls --hls-type fmp4 TearsOfSteel.mp4

Specify more bitrates:

./video2hls --video-bitrates 8000 4000 2000 1000 \
            --video-widths 1920 1920 1280 854 \
            --video-names '1080p high' '1080p low'
   TearsOfSteel.mp4

When using --debug, you'll get a detailed explanation of the executed commands (and you can copy/paste them):

./video2hls --debug TearsOfSteel.mp4

video2hls's People

Contributors

bartbroere avatar pizza0rodeo avatar skyzyx avatar swiffer avatar vincentbernat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

video2hls's Issues

HLS encryption - AES 128

Hello,

I installed the latest ffmpeg and python 3.6.10 and worked as expected.

I have couple of questions:

  1. Is there a plan to add as an option AES128 encryption?

  2. If I want to use my own bitrates and resolutions, shall I use the following command?
    how can I choose baseline and main profiles?

python video2hls
--video-bitrates 8000 4000 2000 1000 \
--video-widths 1920 1920 1280 854
--video-names '1080p high' '1080p low'
TearsOfSteel.mp4

Thanks

Move audio track to a separate media playlist

When switching between qualities, we download the unchanged audio stream again and again. It seems more efficient to encode audio once and provide it as the only alternative for all video tracks.

#EXTM3U
#EXT-X-VERSION:4
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",DEFAULT=yes,AUTOSELECT=yes,URI="0p_2.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=14096000,RESOLUTION=480x270,FRAME-RATE=24.000,CODECS="avc1.640033,mp4a.40.2",NAME="270p",AUDIO="audio"
270p_0.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=4596000,RESOLUTION=240x134,FRAME-RATE=24.000,CODECS="avc1.4d4020,mp4a.40.2",NAME="135p",AUDIO="audio"
135p_1.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=96000,CODECS="mp4a.40.2",NAME="Audio only"
0p_2.m3u8,AUDIO="audio"

Python 3.6 or 3.8 error

Hello,

I have the following Ubuntu:

Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.2 LTS
Release:	16.04
Codename:	xenial 

and Python 3.6.10 (also tried with 3.8)

but when I am trying to execute it I am getting this error:

File "./video2hls", line 305
    jargs.append(f'`{arg}`')
                          ^
SyntaxError: invalid syntax

Do I need to change the ' to something else?

Thanks
Andrew

Add support for WebVTT subtitles

They may be uncut or cut at a larger interval (like 1 minute). The first option seems easy to implement as we can use a static media playlist.

The master playlist:

#EXTM3U
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",URI="en-subs.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="French",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="fr",URI="fr-subs.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=437304,RESOLUTION=480x352,SUBTITLES="subs"
480.m3u8

The media playlist:

#EXTM3U
#EXT-X-TARGETDURATION:30
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:30.0,
1.vtt
#EXTINF:30.0,
2.vtt
#EXT-X-ENDLIST

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.