GithubHelp home page GithubHelp logo

ffplayout / ffplayout Goto Github PK

View Code? Open in Web Editor NEW
424.0 21.0 91.0 32.95 MB

Rust and ffmpeg based playout

Home Page: https://ffplayout.github.io

License: GNU General Public License v3.0

Shell 0.82% Rust 95.96% Dockerfile 3.10% Python 0.12%
ffmpeg broadcast playlist streaming rtmp hls rust tv playout

ffplayout's Introduction

ffplayout

License: GPL v3

ffplayout-engine (ffplayout)

ffplayout is a 24/7 broadcasting solution. It can playout a folder containing audio or video clips, or play a JSON playlist for each day, keeping the current playlist editable.

The ffplayout applications are mostly designed to run as system services on Linux. But in general they should run on any platform supported by Rust.

Check the releases for pre compiled version.

Features

  • have all values in a separate config file
  • dynamic playlist
  • replace missing playlist or clip with single filler or multiple fillers from folder, if no filler exists, create dummy clip
  • playing clips in watched folder mode
  • send emails with error message
  • overlay a logo
  • overlay text, controllable through ffplayout-frontend (needs ffmpeg with libzmq and enabled JSON RPC server)
  • loop playlist infinitely
  • remote source
  • trim and fade the last clip, to get full 24 hours
  • when playlist is not 24 hours long, loop fillers until time is full
  • set custom day start, so you can have playlist for example: from 6am to 6am, instate of 0am to 12pm
  • normal system requirements and no special tools
  • no GPU power is needed
  • stream to server or play on desktop
  • log to files or color output to console
  • add filters to input, if is necessary to match output stream:
    • yadif (deinterlacing)
    • pad (letterbox or pillarbox to fit aspect)
    • fps (change fps)
    • scale (fit target resolution)
    • aevalsrc (if video have no audio)
    • apad (add silence if audio duration is to short)
    • tpad (add black frames if video duration is to short)
  • output:
    • stream
    • desktop
    • HLS
    • null (for debugging)
  • JSON RPC server, to get information about what is playing and to control it
  • live ingest
  • image source (will loop until out duration is reached)
  • extra audio source, has priority over audio from video (experimental *)
  • multiple audio tracks (experimental *)
  • Stream Copy mode (experimental *)
  • custom filters globally in config, or in playlist for specific clips
  • import playlist from text or m3u file, with CLI or frontend
  • audio only, for radio mode (experimental *)
  • Piggyback Mode, mostly for non Linux systems (experimental *)
  • generate playlist based on template (experimental *)
  • During playlist import, all video clips are validated and, if desired, checked to ensure that the audio track is not completely muted.

For preview stream, read: /docs/preview_stream.md

* Experimental features do not guarantee the same stability and may fail under unusual circumstances. Code and configuration options may change in the future.

ffplayout-api (ffpapi)

ffpapi serves the frontend and it acts as a REST API for controlling the engine, manipulate playlists, add settings etc.

Requirements

  • RAM and CPU depends on video resolution, minimum 4 threads and 3GB RAM for 720p are recommend
  • ffmpeg v5.0+ and ffprobe (ffplay if you want to play on desktop)
  • if you want to overlay text, ffmpeg needs to have libzmq

Install

Check install for details about how to install ffplayout.


JSON Playlist Example

{
    "channel": "Test 1",
    "date": "2019-03-05",
    "program": [{
            "in": 0,
            "out": 647.68,
            "duration": 647.68,
            "source": "/Media/clip1.mp4"
        }, {
            "in": 0,
            "out": 890.02,
            "duration": 890.02,
            "source": "/Media/clip2.mp4",
            "custom_filter": "eq=gamma_b=0.6:gamma_g=0.7[c_v_out]"
        }, {
            "in": 0,
            "out": 149,
            "duration": 149,
            "source": "/Media/clip3.mp4",
            "category": "advertisement"
        }, {
            "in": 0,
            "out": 114.72,
            "duration": 114.72,
            "source": "/Media/image1.jpg",
        }, {
            "in": 0,
            "out": 230.30,
            "duration": 230.30,
            "source": "/Media/image2.jpg",
            "audio": "/Media/audio1.mp3"
        }, {
            "in": 0,
            "out": 2531.36,
            "duration": 2531.36,
            "source": "https://example.org/big_buck_bunny.webm",
            "category": ""
        }
    ]
}

Warning

(Endless) streaming over multiple days will only work if config has a day_start value and the length value is 24 hours. If you only need a few hours for each day, use a cron job or something similar.


HLS output

For outputting to HLS, output parameters should look like:

out:
    ...

    output_param: >-
        ...

        -flags +cgop
        -f hls
        -hls_time 6
        -hls_list_size 600
        -hls_flags append_list+delete_segments+omit_endlist+program_date_time
        -hls_segment_filename /var/www/html/live/stream-%09d.ts /var/www/html/live/stream.m3u8

JSON RPC

The ffplayout engine can run a simple RPC server. A request looks like:

curl -X POST -H "Content-Type: application/json" -H "Authorization: ---auth-key---" \
    -d '{"control":"next"}' \
    127.0.0.1:7070

At the moment this commends are possible:

'{"media":"current"}'  # get infos about current clip
'{"media":"next"}'  # get infos about next clip
'{"media":"last"}'  # get infos about last clip
'{"control":"next"}'   # jump to next clip
'{"control":"back"}'   # jump to last clip
'{"control":"reset"}'  # reset playlist to old state
'{"control":"text", \
  "message": {"text": "Hello from ffplayout", "x": "(w-text_w)/2", "y": "(h-text_h)/2", \
  "fontsize": 24, "line_spacing": 4, "fontcolor": "#ffffff", "box": 1, \
  "boxcolor": "#000000", "boxborderw": 4, "alpha": 1.0}}' # send text to drawtext filter from ffmpeg

Output from {"media":"current"} show:

{
    "media": {
        "category": "",
        "duration": 154.2,
        "out": 154.2,
        "in": 0.0,
        "source": "/opt/tv-media/clip.mp4"
    },
    "index": 39,
    "mode": "playlist",
    "ingest": false,
    "played": 67.80771999300123,
}

If you are in playlist mode and move backwards or forwards in time, the time shift is saved so the playlist is still in sync. Bear in mind, however, that this may make your playlist too short. If you do not reset it, it will automatically reset the next day.

ffplayout's People

Contributors

0duddu avatar dependabot[bot] avatar jb-alvarado avatar juniocalu avatar lavvy avatar luddite478 avatar pybt avatar sarat1669 avatar vba-ds avatar vladimir-g 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ffplayout's Issues

program stats and logging

Hi,

I know that ffplayout is logging to a file which can even be set in the playlist conf or passed in the command line, but that log doesn't tell much about the progress of the currently running file and what is next.

Do you have any idea how to track the playlist and see its progress? for example, I would like to see (now playing, next playing, now playing progress, playlist progress).

error in copy mode

Non existing file produce, in copy mode, an error:

[2019-05-06 09:11:41,705] [ERROR]  Traceback (most recent call last):
[2019-05-06 09:11:41,706] [ERROR]    File "/usr/local/bin/ffplayout.py", line 965, in main
[2019-05-06 09:11:41,706] [ERROR]  + ['{}k'.format(calc_buffer_size())],
[2019-05-06 09:11:41,706] [ERROR]    File "/usr/local/bin/ffplayout.py", line 282, in calc_buffer_size
[2019-05-06 09:11:41,707] [ERROR]  bite_rate = check_output(cmd).decode('utf-8')
[2019-05-06 09:11:41,707] [ERROR]    File "/usr/lib/python3.5/subprocess.py", line 316, in check_output
[2019-05-06 09:11:41,707] [ERROR]  **kwargs).stdout
[2019-05-06 09:11:41,707] [ERROR]    File "/usr/lib/python3.5/subprocess.py", line 398, in run
[2019-05-06 09:11:41,707] [ERROR]  output=stdout, stderr=stderr)
[2019-05-06 09:11:41,708] [ERROR]  subprocess
[2019-05-06 09:11:41,708] [ERROR]  .
[2019-05-06 09:11:41,708] [ERROR]  CalledProcessError
[2019-05-06 09:11:41,708] [ERROR]  :
[2019-05-06 09:11:41,708] [ERROR]  Command '['ffprobe', '-v', 'error', '-show_entries', 'format=bit_rate', '-of', 'default=noprint_wrappers=1:nokey=1', '/file.mkv']' returned non-zero exit status 1
[2019-05-06 09:11:41,708] [ERROR]
During handling of the above exception, another exception occurred:
[2019-05-06 09:11:41,708] [ERROR]  Traceback (most recent call last):
[2019-05-06 09:11:41,708] [ERROR]    File "/usr/local/bin/ffplayout.py", line 1026, in <module>
[2019-05-06 09:11:41,709] [ERROR]  main()
[2019-05-06 09:11:41,709] [ERROR]    File "/usr/local/bin/ffplayout.py", line 1022, in main
[2019-05-06 09:11:41,709] [ERROR]  mbuffer.wait()
[2019-05-06 09:11:41,709] [ERROR]  UnboundLocalError
[2019-05-06 09:11:41,710] [ERROR]  :
[2019-05-06 09:11:41,710] [ERROR]  local variable 'mbuffer' referenced before assignment

Script hangs in special situations

[2018-11-25 05:58:20,228] [INFO] play at "5:58:52": ['-i', '....']
[2018-11-25 05:59:17,307] [INFO] we are over time, new_len is: 0.19217100000417986
[2018-11-25 05:59:17,314] [INFO] open: /playlists/2018/11/2018-11-25.xml
[2018-11-25 05:59:17,377] [ERROR] Exception in thread play_clips: Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/usr/local/bin/ffplayout.py", line 607, in play_clips for src_cmd, begin in iter_src_commands: File "/usr/local/bin/ffplayout.py", line 517, in iter_src_commands first, last_time = check_last_item(src_cmd, last_time, last) File "/usr/local/bin/ffplayout.py", line 393, in check_last_item if None in src_cmd and not last: TypeError: argument of type 'NoneType' is not iterable

The problem is to, that the script is not stopping totally. The ffmpeg streaming process can still running, what preventing the ffplayout service to restart.

drawtext: remove text file and send text with libzmq

Hey everybody,
I would like to remove the text file setting from drawtext filter. The reason is, that I have write a messenger with GUI. That makes it possible to send messages to ffplayout through libzmq, which are in my opinion is much more convenience.

Is there anybody how still prefer to work with the text file?

Question: length key in playlist

I'm not sure if it makes sense to have the length option in playlist. Maybe it makes more sense to have it in config file as global parameter.

Any options to this?

TCP port 1935 error

Hi, just a question

When streaming using ffplayout, is SRS or Nginx-RTMP neccessary to get ffplayout playing? Main reason I'm asking this is that when I use this command with a valid json file in order to test ffplayout status:

python3 ffplayout.py -l ~/ffplayout.log -f ~/playlist.json

I get this

image

My port is open in Firewall and disabling firewall doesn't make any changes.
image

This is third time I'm installing ffplayout-engine however this is new to me. Have in mind I don't have nginx-rtmp or SRS installed but from what I remember it doesn't need either to stream, correct?

FFMPEG is not bundled with FFServer, I don't think we use FFserver hence I don't have any configurations.

I'm installing SRS on docker ubuntu 19 but regardless when I google this error, all talking about ffserver. Does port 1935 has to listen? Can't we just stream rtmp?

Thanks

s302m audio codec error

The s302m audio codecs produce randomly errors. the message is:

[mpegts @ 0x564ee56a46c0] Could not find codec parameters for stream 1 (Audio: s302m (BSSD / 0x44535342), 0 channels): unspecified sample format
Consider increasing the value for the 'analyzeduration' and 'probesize' options

...

Stream #0:1[0x101]: Audio: s302m (BSSD / 0x44535342), 0 channels
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (rtmp://localhost/live/stream) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

I have to test mp2 again.

a fall back video

Hi a quick question that I needed to ask and Config guide kind of lost me there. If a playlist is less than 24 hours, I'd like to have a back up video to fill up rest of the remaining time. As an example my start time is 00:00 and end of day is 24:00, I have a playlist that has 23 hrs duration, would it be possible to have a video to play instead of gen_dummy() function? Would it be possible to return a video file instead to stream? Is there anyway to achieve that in current configuration?

Thanks

Maximum possible video quality

Hi!
I set maximum video quality trough ffplayout.yml, but its looks ugly at some point (especialy at dark parts of video or when there is a lot of movement).
Any special configs or some advice?
Sry for asking here, i wrote you an email, but you dont answer.. ๐Ÿ˜ถ

RTMP Url is not play when in play-out

it show in log

Aug 18 10:07:11 s54689 systemd[1]: Stopping python and ffmpeg based playout...
Aug 18 10:07:11 s54689 ffplayout.py[3086]: av_interleaved_write_frame(): Broken pipe
Aug 18 10:07:11 s54689 systemd[1]: ffplayout.service: Main process exited, code=dumped, status=3/QUIT
Aug 18 10:07:11 s54689 systemd[1]: Stopped python and ffmpeg based playout.
Aug 18 10:07:11 s54689 systemd[1]: ffplayout.service: Unit entered failed state.
Aug 18 10:07:11 s54689 systemd[1]: ffplayout.service: Failed with result 'core-dump'.
Aug 18 10:07:11 s54689 systemd[1]: Started python and ffmpeg based playout.

Take next?

Would it possible to implement a "take next" feature? i.e. drop the currently playing clip and play the next one now.

Loop a clip and loop playlist

Hi,

Can a clip in the playlist be looped for "n" times? also, can the playlist be looped?

I have the following list for example .. and I would like to loop the first clip 5 times and then loop the whole playlist over and over, can that be done?

{
    "channel": "Test 1",
    "date": "2019-08-20",
    "program": [
        {
            "begin": "0:00:00.000",
            "in": 0,
            "out": 15.162,
            "duration": 15.162,
            "source": "/home/ffplayout-engine/test-clips/Peru_00-00-15.mp4"
        },
        {
            "begin": "0:00:00.000",
            "in": 0,
            "out": 120.162,
            "duration": 120.162,
            "source": "/home/ffplayout-engine/test-clips/Orchid_00-02-00.mp4"
        }
    ]
}

What does this function really do? "# loop through all clips in playlist"

Unexpected behaviour on HLS multi variant

Hi again :)

At this stage I'm trying to have HLS variant setup on same server I'm streaming RTMP from. After spending some time I realized that when I setup HLS variants as per as instructions on HLS RTMP Module documentation and restart nginx, FFPlayout-engine crashes and not working any more.

Have you experience this before? I have one service worker on Nginx and 8 cores CPU with 64GB ram. Is there any way we can have multi stream from FFPlayout to Nginx? Or is there anyway to resolve this?

I've also checked syslog, nginx logs, ffmpeg logs, ffmpeg-playout logs and I can't see any errors. If I reverse nginx configuration to serve one HLS (so there is no need to encode using FFMPEG) everything runs fine.

Thanks

apk add ffplayout

ffplayout is growing successfully as a portable cloud app service. It will be fine to add it to alpine repo as alpine is now being used mostly as base for docker containers in the cloud.

[encoder] "rtmp://localhost/live/stream": No such file or directory (Broken pipe)

Hi,

I am using the latest version of the master branch (as the time of I am writing) because the releases weren't working at all - and this branch was the closest to start on my server.

When I am trying to land out the service with a similar line/command like this:

./ffplayout.py -l none -p ~/<directory_path>/ffplayout-engine/playlist.json -d -s now -t none -c ~/<directory_path>/ffplayout-engine/ffplayout.yml

It seems it's going to start without any problems, then a strange issue happens as like mentioned in the Title also, here is the complete initialization process. "No such file or directory" at the encoder initialization, which should be the output stream of the server, isn't it? I am using NGINX as a passthrough service for it - which is working fine with the ffmpeg command itself (it's working fine with RTMP so I assume it should with ffplayout).

[WARNING]  ffmpeg contains no libfdk-aac! No high quality aac...
[2020-07-18 19:09:33,345][INFO]     Open: /<directory_path>/ffplayout-engine/playlist.json
[2020-07-18 19:09:33,591][DEBUG]    src_cmd: "['-i', '/<directory_path>/<file_name>.mp4', '-filter_complex', '[0:v]pad=ih*1024/576/sar:ih:(ow-iw)/2:(oh-ih)/2,fps=25,scale=1024:576,setdar=dar=1.778[v];movie=docs/logo.png,loop=loop=-1:size=1:start=0,format=rgba,colorchannelmixer=aa=0.7[l];[v][l]overlay=W-w-12:12:shortest=1[vout1]', '-filter_complex', '[0:a]anull[aout1]', '-map', '[vout1]', '-map', '[aout1]']"
[2020-07-18 19:09:33,592][INFO]     Play: "/<directory_path>/<file_name>.mp4"
[2020-07-18 19:09:33,828][ERROR]    [decoder] [mpeg2video @ 0x5645cae28880] stuffing too large
[2020-07-18 19:09:33,839][ERROR]    [decoder] [mpeg2video @ 0x5645cae28880] Error evaluating rc_eq "(null)"
[2020-07-18 19:09:35,220][ERROR]    [encoder] "rtmp://localhost/live/stream": No such file or directory
[2020-07-18 19:09:35,228][ERROR]    [decoder]     Last message repeated 440 times
[2020-07-18 19:09:35,234][ERROR]    Broken Pipe!

I think it's great to mention the complete output of "ffmpeg --version" here:

ffmpeg version 4.3-3ubuntu1~18.04.sav0 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version='3ubuntu1~18.04.sav0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-crystalhd --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100

I hope it is enough information for my issue ticket, feel free to let me know. :)

Subtitles

Hi @jb-alvarado ,

This is a feature request that I think it can add so much value to this repo.

Description:

Ability to support multiple subtitle for on-demand videos. This should be limited to videos hosted and not live streams ingested throughout third parties.

Subtitles shouldn't necessarily be included in PRE-COMP but ability to reference subtitles in JSON file and requested using HTML5 Player when a video begins or is already streaming. I think this is the best approach to avoid any backend overhead and could support more than one language.

Ideally another JSON output could handle this event, by just outputting what is being streamed.

Any thoughts?

Logo show/hide

Hi,

I'm working on RESTful API to modify ffplayout.conf and would like to be able to set a show/hide logo in the configuration file like:

[PRE_COMPRESS]
show_logo = True/False

Would it make sense?

The idea is to make a separate playlist config file for each playlist using RESTful API.

Missing Playlist

When the following playlist is missing, the first clip from the old playlist will play, after it is done the playout restarts because it is out of time.

There is also no error mail...

Can't get ffplayout to work

Hi,

Thanks for the nice work.

I have followed your guide in ffplayout and ffplayout GUI but I can't get it to work.

Here is the output of the logs file:
[2018-11-03 21:04:13,146] [INFO] open: /playlists/2018/11/2018-11-03.xml
[2018-11-03 21:04:13,147] [ERROR] Playlist is not valid! /playlists/2018/11/2018-11-03.xml
[2018-11-03 21:04:13,147] [INFO] play at "21:04:55": ['-f', 'lavfi', '-i', 'color=s=1024x576:d=60', '-f', 'lavfi', '-i', 'anullsrc=r=44100', '-shortest']
[2018-11-03 21:04:13,149] [ERROR] xml playlist is not long enough! total play time is: 3844.183333000001

Regards,
Mustafa

hardware decoding/encoding

This question I got ask by email, but I think it could be interessting for others to.

The question was how to integrate hw decoding/encoding in ffplayout.

Please give me some working ffmpeg examples - then I can answer this question better and also think about if it is possible to integrate it in ffplayout directly.

Playlist to short

In dev branch is a bug:

  • the dummy clip don't needs a audio filter
  • the playlist don't change to the next day.

Change playlist format to json?

I'm thinking about changing the playlist format to json.

Does somebody depend on xml? When yes I could imagine to support both formats and add a selection in config file...

Failed to start python and ffmpeg based playout

Hi,
I face an issue on ffplayout engine. It shows error on starting the service. "Failed to start python and ffmpeg based playout"

ffplayout-engine.service - python and ffmpeg based playout
Loaded: loaded (/etc/systemd/system/ffplayout-engine.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2020-07-30 15:16:35 UTC; 3s ago
Process: 3033 ExecStart=/opt/ffplayout-engine/venv/bin/python /opt/ffplayout-engine/ffplayout.py (code=exited, status=1/FAILURE)
Main PID: 3033 (code=exited, status=1/FAILURE)
Jul 30 15:16:34 ffplayout-1 systemd[1]: ffplayout-engine.service: Main process exited, code=exited, status=1/FAILURE
Jul 30 15:16:34 ffplayout-1 systemd[1]: ffplayout-engine.service: Failed with result 'exit-code'.
Jul 30 15:16:35 ffplayout-1 systemd[1]: ffplayout-engine.service: Service RestartSec=1s expired, scheduling restart.
Jul 30 15:16:35 ffplayout-1 systemd[1]: ffplayout-engine.service: Scheduled restart job, restart counter is at 5.
Jul 30 15:16:35 ffplayout-1 systemd[1]: Stopped python and ffmpeg based playout.
Jul 30 15:16:35 ffplayout-1 systemd[1]: ffplayout-engine.service: Start request repeated too quickly.
Jul 30 15:16:35 ffplayout-1 systemd[1]: ffplayout-engine.service: Failed with result 'exit-code'.
Jul 30 15:16:35 ffplayout-1 systemd[1]: Failed to start python and ffmpeg based playout.

include a Dockerfile

This is obviously a young project but looks ambitious. It's simple, light and looks straightforward. It uses ffmpeg which can handle video and audio unlike other radio stations out there and obviously run in the cloud. Its quite awesome.
I see how straight forward it is but it has a many of its piceses scattered all over the place likt the engine, gui, pipeline etc. I have spent about a day trying to stand it up in an alpine instance but no luck.
Even though i know it works but i just couldn't get it work.
I believe this only needs a lamp, python3 and ffmpeg to work, but i was not able to sit the parts in the right locations.
A simple dockerfile can put all the parts in the right locations (alpine preferable)

drawtext from filename

I use ffplayout-engine with a piped output to tvheadend.
This is working very well in random mode on a folder with music videos.
In fact, so well that my friends just don't stop adding great tunes to the library.
The only problem with that is that everyone needs to use shaz* app to find out what they are listening to right now.

I played a bit with drawtext on the complex_filters, but my ffmpeg as well as python skills are just too bad to get it right.

Would it be possible to implement yet another drawtext api, but to the encoder and get some config options for settings like those below?
-when to put the text (after one minute for example)
-duration while the text should be displayed (for one minute)
-a regex/str-replace to filter yt-id's and file extensions from the filenames and such
-font, -size, -color, -position to distinguish the text apis

I thought about adding that through the existing text api, but an extra wrapper that looks after ffmpeg processes is quite a messy solution i guess.

Thank you already for the great work!

Information: remove copy mode

I would like to remove the copy mode. I don't think it is relay stable and the maintaining is more complicate.

If anybody needs this option, write some good reasons and I will think about to let it in.

Customization requests

Hello there,
I'm interested in hiring you for a customization.

If you're interested please, get back to me by Skype: a-art.pdg?

pipe out

Hi, could you tell me how to pipe out ? I tried pipe out using stream and hls but always with error.

Regards.

Broken pipe

Hi,
I have installed , generated playlist and start the service.
When i looked in log file , there is i try to start movie , but finished with Broken pipe .
Any idea ???

Write directly to hls playlist

Writing directly to a hls playlist with only one ffmpeg instance work generally good, except the time shift over 24 hours is bigger. Maybe around 20 seconds. And it can happen, that the cleanup from old segments are not working correct. For this a async function should check the folder for old segments and delete them.

The time shift could be fixed with realtime filter.

The old segments can be removed with something like:

import os
from glob import glob

HLS_PATH = 'test'

test_num = 0
with open(os.path.join(HLS_PATH, 'stream.m3u8'), 'r') as m3u8:
    for line in m3u8:
        if '.ts' in line:
            test_num = int(line.split('-')[1].split('.')[0])
            break


ts_list = sorted(glob(os.path.join(HLS_PATH, '**/*.ts'), recursive=True))

for ts_file in ts_list:
    ts_num = int(ts_file.split('-')[1].split('.')[0])

    if test_num > ts_num:
        os.remove(ts_file)

Broken Pipe in shuffle folder mode

Well, not all fixed.
Its works perfect all night, but when i set "shuffle folder mode" i get:

[2019-12-01 12:04:48,894][ERROR]    [encoder] av_interleaved_write_frame(): Broken pipe
[2019-12-01 12:04:49,003][ERROR]    [encoder]     Last message repeated 1 times
[2019-12-01 12:04:49,003][ERROR]    [encoder] Error writing trailer of rtmp://*: Broken pipe
[2019-12-01 12:04:49,015][ERROR]    [decoder] av_interleaved_write_frame(): Broken pipe
[2019-12-01 12:04:49,055][ERROR]    Broken Pipe!

Need more time to debug this...
Also, what system are you using?

Originally posted by @tg8kuyx3kygbusyf in #41 (comment)

Testing buffer tools

The buffer tools needs to be testet. I think they create different time shifts. Over 24 hours pipebuffer for example create a shift from ~15 seconds.

Issue while changing clips

Hi there,

Few questions here:

  • What should be the buffer and buffer size for 1280 x 720 and 1920 x 1080
  • When changing config to 1280 x 720 my both CPU cores max out? Any reason? I can see I have 80-90% used having running default configuration.
  • I keep getting this error when changing clips, it actually doesn't skip to next MP4 and I ger

Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1024x576 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 1k tbn, 25 tbc Metadata: encoder : Lavc57.107.100 libx264 Side data: cpb: bitrate max/min/avg: 1300000/0/0 buffer size: 2600000 vbv_delay: -1 Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp (24 bit), 128 kb/s Metadata: encoder : Lavc57.107.100 aac [flv @ 0x55ff97cdb6c0] Failed to update header with correct duration. [flv @ 0x55ff97cdb6c0] Failed to update header with correct filesize. frame= 4892 fps= 25 q=-1.0 Lsize= 23741kB time=00:03:15.60 bitrate= 994.3kbits/s speed=0.998x video:20412kB audio:3093kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.003540% [libx264 @ 0x55ff97cdc640] frame I:138 Avg QP:18.25 size: 22685 [libx264 @ 0x55ff97cdc640] frame P:1395 Avg QP:21.21 size: 7370 [libx264 @ 0x55ff97cdc640] frame B:3359 Avg QP:23.55 size: 2230 [libx264 @ 0x55ff97cdc640] consecutive B-frames: 6.6% 4.0% 4.9% 84.5% [libx264 @ 0x55ff97cdc640] mb I I16..4: 50.7% 0.0% 49.3% [libx264 @ 0x55ff97cdc640] mb P I16..4: 19.3% 0.0% 5.1% P16..4: 32.6% 10.8% 4.1% 0.0% 0.0% skip:28.1% [libx264 @ 0x55ff97cdc640] mb B I16..4: 1.6% 0.0% 0.3% B16..8: 30.8% 3.7% 0.4% direct: 2.6% skip:60.6% L0:46.2% L1:50.4% BI: 3.3% [libx264 @ 0x55ff97cdc640] coded y,uvDC,uvAC intra: 23.6% 56.5% 11.5% inter: 4.3% 17.2% 0.4% [libx264 @ 0x55ff97cdc640] i16 v,h,dc,p: 44% 29% 9% 19% [libx264 @ 0x55ff97cdc640] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 23% 22% 4% 4% 5% 4% 4% 3% [libx264 @ 0x55ff97cdc640] i8c dc,h,v,p: 46% 23% 23% 8% [libx264 @ 0x55ff97cdc640] Weighted P-Frames: Y:0.4% UV:0.2% [libx264 @ 0x55ff97cdc640] ref P L0: 68.5% 6.8% 18.9% 5.8% 0.0% [libx264 @ 0x55ff97cdc640] ref B L0: 90.7% 7.8% 1.5% [libx264 @ 0x55ff97cdc640] ref B L1: 96.7% 3.3% [libx264 @ 0x55ff97cdc640] kb/s:854.49

image

Thanks for script

Starting problem when using systemd file

My systemd file:

[Unit]
Description=python and ffmpeg based playout
After=network.target

[Service]
PIDFile=/tmp/ffplayout.pid
ExecStart=/usr/local/bin/ffplayout.py
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
User=root
Group=root

[Install]
WantedBy=multi-user.target

Systemd status:

โ— ffplayout.service - python and ffmpeg based playout
   Loaded: loaded (/etc/systemd/system/ffplayout.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2019-03-17 22:18:27 +06; 14min ago
 Main PID: 3170 (python3.6)
   CGroup: /system.slice/ffplayout.service
           โ”œโ”€3170 python3.6 /usr/local/bin/ffplayout.py
           โ””โ”€3221 /usr/bin/mbuffer -q -c -m 1975k

Mar 17 22:18:27 host.name systemd[1]: Started python and ffmpeg based playout.

Process:

root      3170  0.0  0.3 211704 14820 ?        Ss   22:18   0:00 python3.6 /usr/local/bin/ffplayout.py
root      3221  0.0  0.0  24180  2648 ?        Sl   22:18   0:00 /usr/bin/mbuffer -q -c -m 1975k

But no process for ffmpeg.

However, starting /usr/local/bin/ffplayout.py manually works fine, though I am getting few warnings:

Only '-vf null' read, ignoring remaining -vf options: Use ',' to separate filters
Only '-af apad' read, ignoring remaining -af options: Use ',' to separate filters
[mpegts @ 0x4646f80] Thread message queue blocking; consider raising the thread_queue_size option (current value: 256)

Will appreciate your help.

ignoring remaining

This error maybe will happen when a blank clip is playing instead of an missing video file.

Feb 27 05:59:16 ffplayout python3[19061]: Only '-vf null' read, ignoring remaining -vf options: Use ',' to separate filters
Feb 27 05:59:16 ffplayout python3[19061]: Only '-af apad' read, ignoring remaining -af options: Use ',' to separate filters

Question about loop

Hi, I have read a few documentation and issues to try to figure out the function loop, but I'm still a bit confused.(sorry for my poor comprehension)

You have mentioned that a playlist with play 24/7 if the duration is set to 24 hours but shouldn't that mean the playlist will only play for 24 hours or should I use the crontab to continue playing?

Thank for your developing โค๏ธ.

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.