Coder Social home page Coder Social logo

biim's Introduction

biim

An example for Apple Low Lantency HLS Packager and Origin

Feature

  • MPEG-TS Demuxing and Apple LL-HLS Packaging in pure Python3 (using asyncio)
  • Packaging MPEG-TS stream to HLS media segment (MPEG-TS or fmp4)
    • main.py: Packaging MPEG-TS stream to MPEG-TS segment (for H.264/AVC, AAC, ID3)
      • Support TIMED-ID3 Metadata PassThrough
    • fmp4.py: Packaging MPEG-TS stream to fmp4 segment (for H.265/HEVC, AAC, ID3)
      • Support TIMED-ID3 Metadata to EMSG-ID3 Conversion
  • Support LL-HLS Feature (1s Latency with HTTP/2, 2s Latency with HTTP/1.1)
    • Support Blocking Request
    • Support EXT-X-PRELOAD-HINT with Chunked Transfer
    • NOTE: HTTP/2 is currently not Supported. If use with HTTP/2, please proxing HTTP/2 to HTTP/1.1.
  • In Memory (On the fly) LL-HLS Serving
    • Not use disk space for LL-HLS Delivery

Dependency

  • aiohttp

Usege

Ingest MPEG-TS Stream to biim's STDIN!

# mpegts (for H.264)
ffmpeg xxx -f mpegts - | ./main.py --port 8080
# fmp4 (for H.264/H.265)
ffmpeg xxx -f mpegts - | ./fmp4.py --port 8080

# watch http://localhost:8080/playlist.m3u8

Options

  • -i, --input,
    • Specify input source.
    • if not Specified, use STDIN.
    • if Specified file, throttled for pseudo live serving.
    • DEFAULT: STDIN
  • -t, --target_duration
    • Specify minmum TARGETDURATION for LL-HLS
    • DEFAULT: 1
  • -p, --part_duration
    • Specify PART-TARGET for LL-HLS
    • DEFAULT: 0.1
  • -w, --window_size
    • Specify Live Window for LL-HLS
    • if Not Specifed, window size is Infinify, for EVENT(DVR).
    • DEFAULT: Infinity (None)
  • --port
    • Specify Serving PORT for LL-HLS
    • DEFAULT: 8080

Example (Generate Test Stream H.265(libx265)/AAC With Timestamp)

ffmpeg -re \
  -f lavfi -i testsrc=700x180:r=30000/1001 \
  -f lavfi -i sine=frequency=1000 \
  -vf "settb=AVTB,setpts='trunc(PTS/1K)*1K+st(1,trunc(RTCTIME/1K))-1K*trunc(ld(1)/1K)',drawtext=fontsize=60:fontcolor=black:text='%{localtime}.%{eif\:1M*t-1K*trunc(t*1K)\:d\:3}'" \
  -c:v libx265 -tune zerolatency -preset ultrafast -r 30 -g 15 -pix_fmt yuv420p \
  -c:a aac -ac 1 -ar 48000 \
  -f mpegts - | ./fmp4.py -t 1 -p 0.15 -w 10 --port 8080
# watch http://localhost:8080/playlist.m3u8

Special Thanks

  • xtne6f: C++ ReImplementation (tsmemseg) and Report ISOBMFF related misc bugs.
  • tsukumi: Very helpful advice and implementation to biim's Type Definition.

biim's People

Contributors

monyone avatar tsukumijima 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

biim's Issues

Huge memory usage

Hi @monyone
Thank you for this awesome works, i have been test this, and try to run 1 hours live stream and it's ends up with memory usage spiking to 15 GB. Seems the segment is still being hold even not used anymore.

Is there any guidance on this ?

Thank you

We should team up.

I have a SCTE35 parser, threefive and a SCTE35 aware HLS Segmenter, x9k3 both in python3.

We should team up and take over the World.

Adrian

Local LL-HLS Files

Is there a way to generate the files locally instead of pushing them to localhost:8080 ?

I thought of this, because when I run the script inside a docker container, I get an error such as "Broken pipe" and I couldn't find a solution for that.

So, is there a fix for that or can I generate the files locally? (meaning inside the container)

Problem start

Hello.
I wanted to use your project, but I had a problem. I don't fully understand what type of file should be specified instead of "xxx". I also get an error and an exception when launching your application.
I really hope for your help.
image

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.