Xiu - A simple and secure live media server in pure Rust (RTMP/HTTP-FLV/HLS/Relay).🦀

Overview

XIUcrates.io crates.io RTMPcrates.io crates.io HTTPFLVcrates.io crates.io HLScrates.io crates.io FLVcrates.io crates.io MPEGTScrates.io crates.io wechat qqgroup

中文文档

Xiu is a simple and secure live media server written by pure Rust, it now supports popular live protocols like RTMP/HLS/HTTP-FLV (and maybe other protocols in the future), you can deploy it as a stand-alone server or a cluster using the relay feature.

Features

  • RTMP
    • publish and play
    • relay: static push
    • relay: static pull
  • HTTPFLV
  • HLS
  • SRT

Preparation

Install Rust and Cargo

Document

Install and run

There are two ways to install xiu :

  • Using cargo to install
  • Building from source

Install using cargo

Issue the following command to install xiu:

cargo install xiu

Start the service with the following command:

xiu configuration_file_path/config.toml

Build from souce

Clone Xiu

git clone https://github.com/harlanc/xiu.git

use master branch

Build

cd ./xiu/application/xiu
cargo build --release

Run

cd ./xiu/target/release
./xiu config.toml

Configurations

RTMP
[rtmp]
enabled = true
port = 1935

# pull streams from other server node.
[rtmp.pull]
enabled = false
address = "192.168.0.1"
port = 1935

# push streams to other server node.
[[rtmp.push]]
enabled = true
address = "localhost"
port = 1936
[[rtmp.push]]
enabled = true
address = "192.168.0.3"
port = 1935
HTTPFLV
[httpflv]
# true or false to enable or disable the feature
enabled = true
# listening port
port = 8081
HLS
[hls]
# true or false to enable or disable the feature
enabled = true
# listening port
port = 8080
Log
[log]
level = "info"

Configuration examples

I edit some configuration files under the following path which can be used directly:

xiu/application/xiu/src/config

It contains the following 4 files:

config_rtmp.toml //enable rtmp only
config_rtmp_hls.toml //enable rtmp and hls
config_rtmp_httpflv.toml //enable rtmp and httpflv
config_rtmp_httpflv_hls.toml //enable all the 3 protocols

Scenarios

Push

You can use two ways:

  • Use OBS to push a live rtmp stream

  • Or use FFmpeg to push a rtmp stream:

      ffmpeg -re -stream_loop -1 -i test.mp4 -c:a copy -c:v copy -f flv -flvflags no_duration_filesize rtmp://127.0.0.1:1935/live/test
    
Play

Use ffplay to play the rtmp/httpflv/hls live stream:

ffplay -i rtmp://localhost:1935/live/test
ffplay -i http://localhost:8081/live/test.flv
ffplay -i http://localhost:8080/live/test/test.m3u8
Relay - Static push

The configuration files are as follows:

The configuration file of Service 1 named config.toml:

[rtmp]
enabled = true
port = 1935
[[rtmp.push]]
enabled = true
address = "localhost"
port = 1936

The configuration file of Service 2 named config_push.toml:

[rtmp]
enabled = true
port = 1936

Run the 2 services:

./xiu config.toml
./xiu config_push.toml

Use the above methods to push rtmp live stream to service 1, then the stream can be pushed to service 2 automatically, you can play the same live stream from both the two services:

ffplay -i rtmp://localhost:1935/live/test
ffplay -i rtmp://localhost:1936/live/test
Relay - Static pull

The configuration file are as follows:

The configuration file of Service 1 named config.toml:

[rtmp]
enabled = true
port = 1935

The configuration file of Service 2 named config_pull.toml:

[rtmp]
enabled = true
port = 1936
[rtmp.pull]
enabled = false
address = "localhost"
port = 1935

Run the 2 services:

./xiu config.toml
./xiu config_pull.toml

Use the above methods to push live stream to service 1, when you play the stream from serivce 2, it will pull the stream from service 1:

ffplay -i rtmp://localhost:1935/live/test
ffplay -i rtmp://localhost:1936/live/test

Star History

link

Thanks

Others

Open issues if you have any problems. Star and pull requests are welcomed. Your stars can make this project go faster and further.

Comments
  • event_loop Subscribe error: no app or stream name

    event_loop Subscribe error: no app or stream name

    In my scenario OBS is streaming to rtmp://127.0.0.1:1935/live/test And connection is correctly established

    My config.toml is simply

    [rtmp]
    enabled = true
    port = 1935
    
    # pull streams from other server node.
    [rtmp.pull]
    enabled = false
    address = "localhost"
    port = 1935
    
    [httpflv]
    # true or false to enable or disable the feature
    enabled = true
    # listening port
    port = 8081
    
    [hls]
    # true or false to enable or disable the feature
    enabled = true
    # listening port
    port = 8080
    

    But when I play the stream with any of the two below

    ffplay -i rtmp://localhost:1935/live/test
    ffplay -i http://localhost:8081/live/test.flv
    

    I get 2 errors. One server side

    event_loop Subscribe error: no app or stream name
    

    and one client side

    ffplay -i http://localhost:8081/live/test.flv
    ffplay version 4.4-6ubuntu5 Copyright (c) 2003-2021 the FFmpeg developers
      built with gcc 11 (Ubuntu 11.2.0-7ubuntu1)
      configuration: --prefix=/usr --extra-version=6ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
      libavutil      56. 70.100 / 56. 70.100
      libavcodec     58.134.100 / 58.134.100
      libavformat    58. 76.100 / 58. 76.100
      libavdevice    58. 13.100 / 58. 13.100
      libavfilter     7.110.100 /  7.110.100
      libswscale      5.  9.100 /  5.  9.100
      libswresample   3.  9.100 /  3.  9.100
      libpostproc    55.  9.100 / 55.  9.100
    http://localhost:8081/live/test.flv: Invalid data found when processing input
    
    
    question 
    opened by fgadaleta 12
  • Extreme CPU usage

    Extreme CPU usage

    Hello, I'm not sure if anybody else is experiencing this, but after the update that fixes HLS, the CPU usage skyrockets after I stop streaming from OBS. Screenshot_20211222_144247

    The console output says: [2021-12-22T19:51:00Z ERROR rtmp::channels::channels] event_loop Unpublish err: no stream name

    The same error shows up in 0.0.5 but the CPU usage problem occurs only in 0.0.8

    Another thing that I found is that it's definitely HLS issue, as the problem doesn't occur with hls enabled set to false

    My config.toml file looks like this

    [rtmp]
    enabled = true
    port = 1935
    
    [hls]
    enabled = true
    port = 8080
    
    [httpflv]
    enabled = true
    port = 8081
    
    [log]
    level = "info"
    
    bug 
    opened by Aslan2142 5
  • Xiu - Complex Handshake Failed - When rtmp connection from OBS

    Xiu - Complex Handshake Failed - When rtmp connection from OBS

    Hi,

    I just tried to setup HLS streaming using Xiu from OBS. Encountered the following error while trying to connect rtmp from OBS to Xiu

      cargo run application/xiu/src/config/config_rtmp_hls.toml 
       .... 
      Finished dev [unoptimized + debuginfo] target(s) in 0.06s
      Running `target/debug/xiu application/xiu/src/config/config_rtmp_hls.toml`
    [2022-07-21T09:34:11Z INFO  hls::server] Hls server listening on http://0.0.0.0:8080
    [2022-07-21T09:34:11Z INFO  rtmp::rtmp] Rtmp server listening on tcp://0.0.0.0:1935
    
    [2022-07-21T09:34:27Z INFO  rtmp::handshake::handshake_server] [ S<-C ] [complex handshake] read C0C1
    [2022-07-21T09:34:27Z WARN  rtmp::handshake::handshake_server] complex handshake failed.. err:bytes read error: not enough bytes to read
        
    [2022-07-21T09:34:27Z INFO  rtmp::handshake::handshake_server] [ S<-C ] [simple handshake] read C0C1
    [2022-07-21T09:34:27Z INFO  rtmp::rtmp] session exits, session_type: server, app_name: , stream_name: 
    ^Croot@ayg-cgw-csl1:~/xiu# 
    

    Config File : config_rtmp_hls.toml

    #live server configurations
    #######################################
    #   RTMP configurations(stand-alone)  #
    #######################################
    [rtmp]
    enabled = true
    port = 1935
    
    ######################################
    #    HLS configurations              #
    ######################################
    [hls]
    enabled = true
    port = 8080
    
    #######################################
    #   LOG configurations                #
    #######################################
    [log]
    level = "debug"
    

    I am using the master branch .

    Commit (Master) : commit b1e95b76c796296da168feec6105c61598fd79ca   
    
    bug 
    opened by koolquark 4
  • HLS server returns 404

    HLS server returns 404

    I've tried configuring xiu, following the first sample in the readme.

    After publishing a stream using ffmeg, I can connect to the rtmp and httpflv streams using ffplay with no problem, but I cannot play back the hls stream..the server only returns 404.

    I've tried to connect to http://localhost:8080/live/test/test.m3u8, as indicated in documentation...

    And then, in case there was a typo in the readme, I also tried: http://localhost:8080/live/test/playlist.m3u8 (wowza-style url) http://localhost:8080/live/test.m3u8 (similar to httpflv url)

    All urls return 404 from the xiu server.

    I'm unfamiliar with rust, so I figured before I go digging into the code to see if I can find if there is an alternate url format that works, I should ask here...or see if there are any known issues with the hls server.

    Thanks, -Partap

    bug 
    opened by partap 4
  • Could this crate be used to play internet video?

    Could this crate be used to play internet video?

    I want to build a video player fro multiple platforms(windows,android), the source of which is usually from youtube, or other sources.
    I want to deal with the video part in rust, but not quite sure if this crate is the correct one for me.

    I googled, and it seems that the most recommended is to do with FFmpeg, like this. But I am not sure, so I am asking here. Thanks.

    opened by dbsxdbsx 2
  • HLS VOD support?

    HLS VOD support?

    Hello. I have several questions about features

    Does it support HLS VOD? If so, does it make it on-the-fly packaging (without writing/storing chunks on disk) Does it support mp4, mp3 containers?

    question 
    opened by KudryavtsevDmitry 2
  • Is the HLS output stream

    Is the HLS output stream "live" or cached?

    It seems that HLS chunks are cached in a local folder, so in some conditions it may happen to reproduce "old" content .
    How is managed the local cache (.ts chunks) and "m3u8" index file with "live" / real time streams ?

    Thank you very much,

    question 
    opened by raptpz 2
  • Automatically fix the clippy lints

    Automatically fix the clippy lints

    Here a first batch of fixes, it is just cargo clippy --fix, let me know what you think. If you like the idea I can complete the work by fixing the lints clippy cannot automatically fix.

    opened by lu-zero 1
  • `Bug`:  Always `listening on tcp://0.0.0.0`

    `Bug`: Always `listening on tcp://0.0.0.0`

    Description

    0.0.0.0 is hard-coded at compile time via src/main.rs rather than interpolated at runtime.

    Expected Behavior

    The config file's address value reflects what is printed by the logger.

    Actual Behavior

    $ xiu listening.toml
    [2021-10-15T04:19:32Z INFO  rtmp::rtmp] Rtmp server listening on tcp://0.0.0.0:1935
    
    waiting for reply 
    opened by dmgolembiowski 1
  • [Bug]CPU usage is abnormal.

    [Bug]CPU usage is abnormal.

    Reproduce:

    1 Using obs to push rtmp stream to xiu server. 2 Play the httpflv stream. 3 Shut down the player.

    In Step 1 or 2 the CPU usage is about 3%. In Step 3, the CPU usage can reach to 100%.

    bug 
    opened by harlanc 1
  • cargo.lock: init file

    cargo.lock: init file

    It would be nice if the Cargo.lock could be added to version control. This helps to reproduce builds more accurately. Several package managers depend on this to keep packages from breaking unexpectedly, and it is recommended that all endproducts, e.g. server daemons like xiu, keeps it in VCS

    As it already says in the .gitignore:

    https://github.com/harlanc/xiu/blob/7cd03d079a9ab0516875b5a6b3a7e6a3edee846d/.gitignore#L5-L7

    opened by h7x4 0
  • thread 'tokio-runtime-worker' panicked at 'attempt to add with overflow'

    thread 'tokio-runtime-worker' panicked at 'attempt to add with overflow'

    When I try to send video stream from external device (mavic DJI mini 2) I get error: thread 'tokio-runtime-worker' panicked at 'attempt to add with overflow', /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/rtmp-0.0.14/src/chunk/unpacketizer.rs:421:21 stack backtrace: 0: 0x555555809a7d - std::backtrace_rs::backtrace::libunwind::trace::h9135f25bc195152c at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x555555809a7d - std::backtrace_rs::backtrace::trace_unsynchronized::h015ee85be510df51 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x555555809a7d - std::sys_common::backtrace::_print_fmt::h5fad03caa9652a2c at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:66:5 3: 0x555555809a7d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2b42ca28d244e5c7 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:45:22 4: 0x55555582925c - core::fmt::write::h401e827d053130ed at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/fmt/mod.rs:1198:17 5: 0x5555558051a1 - std::io::Write::write_fmt::hffec93268f5cde32 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/io/mod.rs:1672:15 6: 0x55555580b245 - std::sys_common::backtrace::_print::h180c4c706ee1d3fb at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:48:5 7: 0x55555580b245 - std::sys_common::backtrace::print::hd0c35d18765761c9 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:35:9 8: 0x55555580b245 - std::panicking::default_hook::{{closure}}::h1f023310983bc730 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:295:22 9: 0x55555580af61 - std::panicking::default_hook::h188fec3334afd5be at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:314:9 10: 0x55555580b7d6 - std::panicking::rust_panic_with_hook::hf26e9d4f97b40096 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:698:17 11: 0x55555580b689 - std::panicking::begin_panic_handler::{{closure}}::hfab912107608087a at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:586:13 12: 0x555555809f74 - std::sys_common::backtrace::__rust_end_short_backtrace::h434b685ce8d9965b at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:138:18 13: 0x55555580b3f9 - rust_begin_unwind at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5 14: 0x55555559c593 - core::panicking::panic_fmt::ha6dc7f2ab2479463 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14 15: 0x55555559c45d - core::panicking::panic::hb3ad04c589a0e3c8 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:48:5 16: 0x555555631404 - rtmp::chunk::unpacketizer::ChunkUnpacketizer::read_extended_timestamp::h879dce656afd8562 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/rtmp-0.0.14/src/chunk/unpacketizer.rs:421:21 17: 0x55555562f1fb - rtmp::chunk::unpacketizer::ChunkUnpacketizer::read_chunk::h37a9c9badbc91186 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/rtmp-0.0.14/src/chunk/unpacketizer.rs:154:58 18: 0x55555562e7c5 - rtmp::chunk::unpacketizer::ChunkUnpacketizer::read_chunks::hbb8a8128ebaa4863 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/rtmp-0.0.14/src/chunk/unpacketizer.rs:98:19 19: 0x5555555a5728 - rtmp::session::server_session::ServerSession::read_parse_chunks::{{closure}}::ha64c8515bc5d3e8a at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/rtmp-0.0.14/src/session/server_session.rs:165:26 20: 0x5555555d3e31 - <core::future::from_generator::GenFuture as core::future::future::Future>::poll::h950141e973fb3aee at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19 21: 0x5555555a8428 - rtmp::session::server_session::ServerSession::run::{{closure}}::h23095bb195456cee at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/rtmp-0.0.14/src/session/server_session.rs:95:45 22: 0x5555555d41f1 - <core::future::from_generator::GenFuture as core::future::future::Future>::poll::ha83efaae53ccce2d at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19 23: 0x5555555b741a - rtmp::rtmp::RtmpServer::run::{{closure}}::{{closure}}::ha4e4ea9f263e3224 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/rtmp-0.0.14/src/rtmp.rs:33:48 24: 0x5555555d54bb - <core::future::from_generator::GenFuture as core::future::future::Future>::poll::hef19bebd94a61812 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19 25: 0x5555555d9fff - <core::pin::Pin

    as core::future::future::Future>::poll::h4f4935b2159bf39d at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/future.rs:124:9 26: 0x55555561c5bf - tokio::runtime::task::core::CoreStage::poll::{{closure}}::he10b6d0134dbfa38 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/core.rs:184:17 27: 0x55555560f790 - tokio::loom::std::unsafe_cell::UnsafeCell::with_mut::h9c1842a770393d02 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/loom/std/unsafe_cell.rs:14:9 28: 0x55555561c217 - tokio::runtime::task::core::CoreStage::poll::hd4c60b6b25461345 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/core.rs:174:13 29: 0x5555555e4b84 - tokio::runtime::task::harness::poll_future::{{closure}}::h2fa09fe527077857 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/harness.rs:480:19 30: 0x5555555bb0f3 - <core::panic::unwind_safe::AssertUnwindSafe as core::ops::function::FnOnce<()>>::call_once::h7a4835f3986a91aa at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panic/unwind_safe.rs:271:9 31: 0x5555555c33d0 - std::panicking::try::do_call::he86e6d1a05044b05 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:492:40 32: 0x5555555c638b - __rust_try 33: 0x5555555c1546 - std::panicking::try::hcb6081aedc2f06a3 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:456:19 34: 0x5555556057ba - std::panic::catch_unwind::h1b3eb9fed873e8db at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panic.rs:137:14 35: 0x5555555e25cd - tokio::runtime::task::harness::poll_future::h26071615758edbdf at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/harness.rs:468:18 36: 0x5555555e6fc6 - tokio::runtime::task::harness::Harness<T,S>::poll_inner::h56e62f3e9b3e75fa at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/harness.rs:104:27 37: 0x5555555eda53 - tokio::runtime::task::harness::Harness<T,S>::poll::hed4c37b9836dbdce at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/harness.rs:57:15 38: 0x5555555cd340 - tokio::runtime::task::raw::poll::h84fcf8eb9b926d56 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/raw.rs:194:5 39: 0x5555556e034f - tokio::runtime::task::raw::RawTask::poll::h2f99aff06af6e3a7 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/raw.rs:134:18 40: 0x5555556d0242 - tokio::runtime::task::LocalNotified::run::hf58dcd95a296aafa at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/mod.rs:385:9 41: 0x55555571793c - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}}::he2a7b0ee8da8f342 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/multi_thread/worker.rs:421:13 42: 0x5555556b2b30 - tokio::coop::with_budget::{{closure}}::h404b3b890380a49f at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/coop.rs:102:9 43: 0x555555722c80 - std::thread::local::LocalKey::try_with::hc7e9738795fc0626 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/thread/local.rs:445:16 44: 0x555555720dee - std::thread::local::LocalKey::with::h2cb5e0d122fc9d7a at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/thread/local.rs:421:9 45: 0x555555717850 - tokio::coop::with_budget::h8ffc1faf54a65420 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/coop.rs:95:5 46: 0x555555717850 - tokio::coop::budget::h32d443ad84cb42ee at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/coop.rs:72:5 47: 0x555555717850 - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::he8a004214783ca87 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/multi_thread/worker.rs:420:9 48: 0x5555557170d6 - tokio::runtime::scheduler::multi_thread::worker::Context::run::h61d733a2230750ba at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/multi_thread/worker.rs:387:24 49: 0x555555716ebd - tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::h5710355e47d5fb35 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/multi_thread/worker.rs:372:17 50: 0x5555557148a7 - tokio::macros::scoped_tls::ScopedKey::set::hc2ed74bad8d61a4f at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/macros/scoped_tls.rs:61:9 51: 0x555555716dfa - tokio::runtime::scheduler::multi_thread::worker::run::h7e3c19ce0abfa058 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/multi_thread/worker.rs:369:5 52: 0x555555716c3b - tokio::runtime::scheduler::multi_thread::worker::Launch::launch::{{closure}}::hb0624a9e439673e4 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/multi_thread/worker.rs:348:45 53: 0x5555556ab923 - <tokio::runtime::blocking::task::BlockingTask as core::future::future::Future>::poll::ha279c5821cd1e0f4 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/blocking/task.rs:42:21 54: 0x5555556cf6b0 - tokio::runtime::task::core::CoreStage::poll::{{closure}}::h3c05e7c20ca86385 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/core.rs:184:17 55: 0x5555556c80a0 - tokio::loom::std::unsafe_cell::UnsafeCell::with_mut::h4d77b421bec4aa12 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/loom/std/unsafe_cell.rs:14:9 56: 0x5555556cf548 - tokio::runtime::task::core::CoreStage::poll::h07d4685630622bf9 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/core.rs:174:13 57: 0x5555557201c8 - tokio::runtime::task::harness::poll_future::{{closure}}::h6b5d305cbb9fdfb6 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/harness.rs:480:19 58: 0x55555569c953 - <core::panic::unwind_safe::AssertUnwindSafe as core::ops::function::FnOnce<()>>::call_once::h8253cee07dcaee71 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panic/unwind_safe.rs:271:9 59: 0x55555573bbd2 - std::panicking::try::do_call::h75ee1e8106d24b7d at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:492:40 60: 0x55555573c97b - __rust_try 61: 0x55555573aa66 - std::panicking::try::h00925be4973b9ce4 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:456:19 62: 0x55555573358b - std::panic::catch_unwind::h08ea8bc90e65875a at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panic.rs:137:14 63: 0x55555571ff0e - tokio::runtime::task::harness::poll_future::h6f7ad96c834f4ff6 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/harness.rs:468:18 64: 0x55555571e369 - tokio::runtime::task::harness::Harness<T,S>::poll_inner::h52e898622092e79e at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/harness.rs:104:27 65: 0x55555571ddc4 - tokio::runtime::task::harness::Harness<T,S>::poll::h0523ddaa6489c43b at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/harness.rs:57:15 66: 0x5555556e0442 - tokio::runtime::task::raw::poll::h7e525a5215f2c060 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/raw.rs:194:5 67: 0x5555556e034f - tokio::runtime::task::raw::RawTask::poll::h2f99aff06af6e3a7 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/raw.rs:134:18 68: 0x5555556d0304 - tokio::runtime::task::UnownedTask::run::h8e21c74ca14f0d6a at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/task/mod.rs:422:9 69: 0x5555556ebd17 - tokio::runtime::blocking::pool::Task::run::h312d097a9af7c901 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/blocking/pool.rs:111:9 70: 0x5555556ee40c - tokio::runtime::blocking::pool::Inner::run::h5ccc53e5bf1058b4 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/blocking/pool.rs:346:17 71: 0x5555556ed807 - tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}::h6bc9490258475307 at /home/roman/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/blocking/pool.rs:321:13 72: 0x55555569cbee - std::sys_common::backtrace::_rust_begin_short_backtrace::h3d4c404e5aef540c at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:122:18 73: 0x55555569dee2 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::hb3613c45395f5c63 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/thread/mod.rs:505:17 74: 0x55555569ca22 - <core::panic::unwind_safe::AssertUnwindSafe as core::ops::function::FnOnce<()>>::call_once::hb8c4b570c00d0a55 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panic/unwind_safe.rs:271:9 75: 0x55555573bb44 - std::panicking::try::do_call::h6dc208d38e2dc48d at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:492:40 76: 0x55555573c97b - _rust_try 77: 0x55555573af20 - std::panicking::try::h61bae38ced0c518e at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:456:19 78: 0x555555733632 - std::panic::catch_unwind::h146004fa0d735b98 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panic.rs:137:14 79: 0x55555569dcdf - std::thread::Builder::spawn_unchecked::{{closure}}::ha25b0aedaeeee137 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/thread/mod.rs:504:30 80: 0x5555556d35df - core::ops::function::FnOnce::call_once{{vtable.shim}}::h1bc1368997c17b72 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5 81: 0x55555580e293 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once::h56d5fc072706762b at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/alloc/src/boxed.rs:1935:9 82: 0x55555580e293 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once::h41deef8e33b824bb at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/alloc/src/boxed.rs:1935:9 83: 0x55555580e293 - std::sys::unix::thread::Thread::new::thread_start::ha6436304a1170bba at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys/unix/thread.rs:108:17 84: 0x7ffff779b6db - start_thread at /build/glibc-CVJwZb/glibc-2.27/nptl/pthread_create.c:463 85: 0x7ffff6f2261f - clone at /build/glibc-CVJwZb/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 86: 0x0 -

    bug 
    opened by rutmir 20
  • [RTMP] Add configuration to turn GOP cache on or off

    [RTMP] Add configuration to turn GOP cache on or off

    • Opening the GOP causes the player to open the video immediately, but with a higher delay.
    • Closing the GOP caching may cause the player to wait the video, but with a smaller latency.
    enhancement 
    opened by harlanc 0
  • thread 'tokio-runtime-worker' panicked at 'attempt to subtract with overflow'

    thread 'tokio-runtime-worker' panicked at 'attempt to subtract with overflow'

    I've configured xiu with a simple RTMP server: [rtmp] enabled = true port = 1935

    I then publish a sample RTMP stream with ffmpeg: ffmpeg -re -stream_loop -1 -i sample_video.mp4 -vcodec libx264 -acodec aac -f flv rtmp://127.0.0.1:1935/live/test

    When the input stream is stopped, I got the following error on xiu server:

    thread 'tokio-runtime-worker' panicked at 'attempt to subtract with overflow', C:\Users\Administrator.cargo\registry\src\github.com-1ecc6299db9ec823\rtmp-0.0.1 0\src\chunk\unpacketizer.rs:422:25

    Is there a way to avoid it ?

    Notes:

    • tried with xiu 0.0.9
    • both "xiu" and "ffmpeg" are running on Windows Server O.S.
    bug 
    opened by raptpz 7
  • Support RTMP URL parameters

    Support RTMP URL parameters

    Configuration:

    [rtmp]
    enabled = true
    port = 1936
    [rtmp.pull]
    enabled = true
    address = "127.0.0.1"
    port = 1935
    

    Play with ffplay

    ffplay -i rtmp://127.0.0.1/live/test?token=123456
    

    xiu output:

    [2021-11-03T01:10:43Z INFO  rtmp::relay::pull_client] receive pull event, app_name :live, stream_name: test?token=123456
    [2021-11-03T01:10:43Z INFO  rtmp::session::client_session] [C -> S] handshake...
    [2021-11-03T01:10:43Z ERROR rtmp::relay::pull_client] client_session as pull client run error: handshake error: bytes read error: not enough bytes to read
    

    The server of pull address rmtp://127.0.0.1:1935 validates url parameter token to control user access.

    new feature 
    opened by asypost 1
Releases(v0.0.11)
  • v0.0.11(Aug 28, 2022)

  • v0.0.10(Jan 31, 2022)

  • v0.0.9(Dec 24, 2021)

  • v0.0.8(Dec 4, 2021)

    This release includes the following changes:

    • fix errors that the HLS files cannot be generated successfully.[#15]

    此次发布包括如下改动:

    • 修复HLS文件不能正确被生成的错误。[#15]
    Source code(tar.gz)
    Source code(zip)
  • v0.0.5(Sep 5, 2021)

    This release includes the following changes:

    • Support cache GOP.
    • Bug fix.

    此次发布包括如下改动:

    • 支持缓存GOP。
    • Bugs 修复。
    Source code(tar.gz)
    Source code(zip)
  • v0.0.4(Aug 21, 2021)

  • v0.0.2(Aug 18, 2021)

    This release includes the following changes:

    • Support remux RTMP stream to HTTPFLV stream.
    • Support remux RTMP stream to HLS stream.
    • Bug fix.
    • Add detailed logs.

    此次发布包括如下改动:

    • 支持将RTMP协议直播流转封装为HTTPFLV协议的流。
    • 支持将RTMP协议直播流转封装为HLS协议的流。
    • Bugs 修复。
    • 添加更加详细的日志。
    Source code(tar.gz)
    Source code(zip)
  • v0.0.1(May 15, 2021)

    This is a pre-release, it includes the following features:

    • A RTMP server for live stream publish and play.
    • RTMP live stream relay including static push and pull.

    It includes three crate libraries:

    • RTMP protocol library.
    • A FLV tag parser library.
    • A network IO library for reading and writing networking bytes easily.

    此次发布包括如下功能:

    • 支持RTMP流的发布和播放。
    • 支持RTMP流的转发,包括转推和回源。

    此次发布下面三个crate库:

    • RTMP协议库。
    • FLV tag解析库。
    • 一个方便读写网络字节流的IO库。
    Source code(tar.gz)
    Source code(zip)
Owner
HarlanC
C/C++/golang/rust audio/video
HarlanC
A ffmpeg/rust based HLS stream generator

hls-streamer Stream your heart's content with HLS. Movtivation I've got a CCTV camera from AliExpress, I know I can use ffmpeg hls demuxer to split up

null 16 Jan 9, 2023
GStreamer HTTP Live Streaming Plugin

A highly configurable GStreamer HLS sink plugin. Based on the hlssink2 element. The flexhlssink is written in Rust and has various options to configure the HLS output playlist generation.

Rafael Carício 13 Oct 25, 2021
A simple CLI for UPnP media file streaming

Slingr A simple CLI for streaming media files over a local network to UPnP media renderers. Designed to work with cheap HDMI/DLNA/UPnP/Miracast Dongle

Yuval Adam 33 Aug 20, 2022
Play your favorite live streams from command line

Streamlib Streamlib is a meta-player for media streams. The streamlib CLI works against a curated library of video and audio streams, and enables quer

Streamlib 27 Jul 4, 2021
Dim, a media manager fueled by dark forces.

Dim, a media manager fueled by dark forces.

Dusk Labs 3.1k Jan 8, 2023
Pure-rust implementation of legacy H.263 video codec and associated color transforms

website | demo | nightly builds | wiki h263-rs h263-rs is a pure-Rust implementation of ITU-T Recommendation H.263 (2005/08), a video codec commonly u

Ruffle 7 Dec 18, 2022
Simple playground project to explore the YUV4MPEG2 format.

2mpeg4yuv Simple playground project to explore the YUV4MPEG2 format. Quick Start Install the Rust Compiler Preview $ ./build.sh $ ./2mpeg4yuv preview

Tsoding 19 Dec 28, 2022
A library for calculating simple moving averages

simple_moving_average This crate provides several algorithms for calculating the simple moving average (SMA) of a series of data samples. SMAs are com

Oskar Gustafsson 5 Oct 9, 2021
The fastest and safest AV1 encoder.

rav1e The fastest and safest AV1 encoder. Table of Content Overview Features Documentation Releases Building Dependency: NASM Release binary Unstable

Xiph.Org Foundation 3k Jan 3, 2023
Plays back videos in your terminal in an insanely slow and inefficient way.

term-video I guess this is usable now... Compilation Since this project is built using Rust, install its toolchain first, for example using rustup. gi

Pascal Puffke 7 Feb 23, 2022
A CLI tool that converts videos to ASCII and displays them to the terminal on the fly

A CLI tool that converts videos to ASCII and displays them to the terminal on the fly

Luke T 19 Nov 15, 2022
Gyroflow is an application that can stabilize your video by using motion data from a gyroscope and optionally an accelerometer

Gyroflow is an application that can stabilize your video by using motion data from a gyroscope and optionally an accelerometer. Modern cameras record that data internally (GoPro, Sony, Insta360 etc), and this application stabilizes the captured footage precisely by using them. It can also use gyro data from an external source (eg. from Betaflight blackbox).

Gyroflow 3.9k Jan 5, 2023
Lumiere is a proof-of-concept/example video player built with the Slint UI framework and libmpv

Lumiere is a proof-of-concept/example video player built with the Slint UI framework and libmpv. This was built quickly to try out Slint and it's new OpenGL underlay feature.

Valerian G. 25 Nov 21, 2022
ffmpeg libraries precompiled for WebAsembly/WASI, as a Rust crate.

FFMPEG crate for WebAssembly/WASI This crate bundles FFMPEG's libraries, precompiled for WebAssembly. No native installation required. Compatible with

Frank Denis 45 Dec 14, 2022
Rust high level RTSP client

RRTSP Client Currently works, but a lot of work to do. PRs welcome! Examples, crates.io, better Readme.md and other things coming soon.

Lucas Zanela 13 Dec 26, 2022
rsmpeg is a thin&safe layer above the FFmpeg's Rust bindings

A Rust crate that exposes FFmpeg's power as much as possible.

Lark Technologies Pte. Ltd. 384 Jan 2, 2023
High-level RTSP multimedia streaming library, in Rust

High-level RTSP multimedia streaming library, in Rust. Good support for ONVIF RTSP/1.0 IP surveillance cameras, as needed by Moonfire NVR. Works around brokenness in cheap closed-source cameras.

Scott Lamb 108 Jan 8, 2023
Rust-based video player for astrophotography

Astro Video Player Rust-based video player for astrophotography videos in SER and AVI format. Supports debayering of RAW color images. Status: Works w

Andy Grove 6 May 7, 2022
A not well-named youtube's videos downloader written in Rust 🦀

ytdl-rs A not well-named youtube's videos downloader written in Rust ?? For information about how to use, legal section, next steps in the project, co

Alejandro Lopez 6 Jun 17, 2022