Open StarveTheEgo opened 4 years ago
Thanks for this detailed report! At first glance, it looks like the error is coming from the gstreamer internals:
GU.flush ~log:self#log
~on_error:(fun err -> raise (Flushing_error err))
el.bin )
I think it's safe to assume that whatever bug you are encountering will need to be chased there. Couple of thoughts about this:
LIQ_GST_DEBUG_LEVEL
environment variableRelated to this: I would consider giving the internal ffmpeg encoder in the master
branch for this. We're actively working on it so I wouldn't say it's necessarily ready for production right now but we'd love some early testing and feedback, which would help gets us ready quicker and, when we'll be, this should be a much better solution that gstreamer.
Thank you for your time :-)
I'm not sure if gstreamer is designed to stream for that amount of time
Before last update of everything (liquidsoap, gstreamer and dependencies) it was working for months without interruptions (with output crash in the end)
But also, probably, issue appears more often after i changed quality from 720p to 1080p, which could just speed up that crash
I will check what is gstreamer designed to do, thank you for this direction
You can set gstreamer's logs verbosity via the LIQ_GST_DEBUG_LEVEL environment variable
I will set gstreamer verbose logging tonight and report on next crash (after 47 hours :-D)
Then i will give ffmpeg encoder a try and participate in testing this way :-)
Or your suggestion is to better try ffmpeg in first place? Not a problem for me, especially if you say it will be better solution in the future
Thank you for your time :-)
I'm not sure if gstreamer is designed to stream for that amount of time
Before last update of everything (liquidsoap, gstreamer and dependencies) it was working for months without interruptions (with output crash in the end)
But also, probably, issue appears more often after i changed quality from 720p to 1080p, which could just speed up that crash
It's possible. I don't think that we've touched much on gstreamer for a while.
I will check what is gstreamer designed to do, thank you for this direction
You can set gstreamer's logs verbosity via the LIQ_GST_DEBUG_LEVEL environment variable
I will set gstreamer verbose logging tonight and report on next crash (after 47 hours :-D)
Great
Or your suggestion is to better try ffmpeg in first place? Not a problem for me, especially if you say it will be better solution in the future
My vision long-term is to deprecate gstreamer and encourage to use ffmpeg as much as possible. Gstreamer is designed for GUI applications, it's been complicated to retrofit it for our use-case and I'm anticipating a lot of similar glitches in the future.
Okay, not very related, noob question: I tried to build and install liquidsoap-full, using this guide (https://github.com/savonet/liquidsoap-full/blob/master/README.md), but did not have success
I face error messages while trying to run make install
(otherwise i do not know what i built it for)
At start, it said that it could not find 'ocamlfind', so i installed this via apt
Then it said it could not find 'prce', so i installed this package via apt too, apt install libpcre-ocaml-dev
^ Worth to mention, both packaged were installed by opam, but still i had those errors, so decided to lucky try with apt installation
And now it says:
ocamlfind: Package `sedlex' not found
But sedlex package is installed in opam too
opam install sedlex
[NOTE] Package sedlex is already installed (current version is 2.2).
And i did not have a luck finding apt package for this
eval $(opam config env)
is always executed
What could help me to fix this issue? :-)
I am also sleepy, maybe there is some way to magically pin everything and install it via opam? I really feel like i went some wrong way at installing this
It seems that for some reason your opam packages are not detected. For sedlex you can install libsedlex-ocaml-dev
via apt.
Okay, so, managed to do clean install of everything liquidsoap-related without involving apt
One problem i faced, i was unable to install tsdl due to compile error I guess, i'll just wait author or tsdl to fix it or something (or maybe my setup requires some fixes, i will check tonight) Changed video.add_text.sdl to video.add_text.gd in my script
But this is not relevant
Here are notable lines from my script now, i am trying to use ffmpeg to stream to YouTube:
audio_samplerate = 44100
video_width = 1920
video_height = 1080
video_framerate = 25
set("frame.audio.samplerate", audio_samplerate)
set("frame.video.width", video_width)
set("frame.video.height", video_height)
set("frame.video.framerate", video_framerate)
set("ffmpeg.scaling_algorithm","fast_bilinear")
output.youtube.live.ffmpeg(
on_start = clear_app_cache,
on_stop = log_output_stop,
bitrate = 12000,
url = restream_host,
key = restream_key,
quality = "veryfast",
combined_stream
)
My current ffmpeg is:
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
Here are some results:
2020/06/29 05:26:29 [clock.main:2] We must catchup 6.16 seconds!ate= 790.7kbits/s speed=0.318x
(catchup duration increases every time)
Guessed Channel Layout for Input Stream #0.1 : stereo
[libx264 @ 0x5598058d37a0] -qscale is ignored, -crf is recommended.
[libx264 @ 0x5598058d37a0] VBV maxrate unspecified, assuming CBR
[libx264 @ 0x5598058d37a0] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=50 keyint_min=5 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=cbr mbtree=1 bitrate=12000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=12000 vbv_bufsize=512 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://stream_link_here/key':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1920x1080, q=-1--1, 12000 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/12000000 buffer size: 512000 vbv_delay: -1
Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz, stereo, s16p, 712 kb/s
Metadata:
encoder : Lavc57.107.100 libmp3lame
What i would love to be able to control in my script:
1. Set audio encoder other than libmp3lame
2. Change audio bitrate
3. Pass some special options for h264 (for example, tune=zerolatency and key-int-max)
And about this issue thread, - do we close it (as gstreamer is planned to be deprecated) and create issue to track ffmpeg things?
Update 30.06.2020: will try external ffmpeg output with full customization and report later
Okay, so i tried to test with 720p first, like this:
set("frame.video.width", 1280)
set("frame.video.height", 720)
set("frame.video.framerate", 25)
set("frame.audio.samplerate", 44100)
set("frame.audio.channels", 2)
def output.restream.ffmpeg(
~id="",
~url="rtmp://restream.io/live",
~video_codec="libx264",
~video_bitrate="3M",
~audio_codec="aac",
~audio_bitrate="128K",
~output_quality = "ultrafast",
~framerate = 25,
key,
source
) =
output.external.ffmpeg(
id = id,
fallible = true,
"-coder 1 -r #{framerate} -g 50 -pixel_format yuv420p -b:v #{video_bitrate} -minrate #{video_bitrate} -maxrate #{video_bitrate} -bufsize 3128K -vcodec #{video_codec} -c:a #{audio_codec} -b:a #{audio_bitrate} -profile:a aac_low -preset #{output_quality} -tune zerolatency -threads 0 -rtmp_live live -f flv \"#{url}/#{key}\"",
source
)
end
I am quite new to ffmpeg usage, so i could let some mistakes to be there, though i used official documentation After playing with parameters this was best result i achieved so far, stream is less laggy, but:
I believe this issue is solely around ffmpeg arguments i provide there, so can you please suggest anything related to those?
Htop shows only like ~13% load of cores, so i do not think i have no resources for this
With verbose logging it spams with:
[NULL @ 0x7fe448550380] sample/frame number mismatch in adjacent frames
Worth to mention, that i tried to go back to gstreamer (but still with dev build) - audio sounds choppy there too
I am trying to play with settings for few days in a row already Since it now sounds same way choppy with gstreamer, i am trying to run gstreamer version first (as it was working before)
Some notable lines from my script:
audio_samplerate = 48000 # trying 48000 this time instead of 44100
video_width = 1280 # trying 1280x720 for first; while it was working for 1920x1080
video_height = 720
video_framerate = 25
def output.restream.live(~id="",
~video_bitrate=2000,
~audio_encoder="fdkaacenc",
~audio_bitrate=128000,
~url="rtmp://restream.io/live",
~key,
source) =
video_pipeline = "videoconvert ! x264enc bitrate=#{video_bitrate} byte-stream=false key-int-max=50 bframes=0 aud=true tune=zerolatency speed-preset=ultrafast ! video/x-h264,profile=main ! queue ! mux."
audio_pipeline = "audioconvert ! #{audio_encoder} bitrate=#{audio_bitrate} ! queue ! mux."
pipeline = "flvmux streamable=true name=mux ! rtmpsink location=\"#{url}/#{key} live=1\""
output.gstreamer.audio_video(
id=id,
video_pipeline=video_pipeline,
audio_pipeline=audio_pipeline,
pipeline=pipeline,
fallible=true,
on_error = fun(_) -> 15.0,
source
)
end
output.restream.live(
audio_encoder = "avenc_aac",
#audio_encoder = "voaacenc",
video_bitrate = 4000,
audio_bitrate= 128000, # trying 128000 instead of 320000
url = restream_host,
key = restream_key,
combined_stream
)
I am currently out of ideas (but still trying daily), so decided to post an example how it sounds here: https://www.youtube.com/watch?v=MX33Cm1cXa0 Perhaps, you could bring me an idea from just hearing this :-)
Okay, since no one answers here, i will get back to latest release version and will turn gstreamer verbose logging on, so we can at least monitor this issue :-) Will report in 2 days !
Hello! I'm catching up on all current bugs, I hope to get back to this soon.
Hi! I'm gonna move this from 1.4.3
to 2.0.0
. Version 2 is definitely the right one to debug video. Let's revisit this shortly when the code is almost feature-complete.
Hello, dear liquidsoap developers! :-)
Describe the bug After updating to 1.4.2 (but at same time after modifying my radio script, so not really sure after what exact change), i am having exactly same error, that happens every 47 hours (+/ -30minutes)
To Reproduce Not sure, but i will just provide some base version of my radio script. Please, note, that i tried to anonymize it while posting here, so it will not work from scratch, sorry. I posted a script with a hope that there is maybe some issue in my script
I am using liquidsoap-daemon to run it as service
Expected behavior Expected behavior is not to stop streaming every 47 hours (so i will not have to restart radio service every 2 days)
Version details
Install method Installed via opam, current setup is: