Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ingress capture card #204

Open
JonnyTech opened this issue Sep 7, 2024 · 13 comments
Open

Ingress capture card #204

JonnyTech opened this issue Sep 7, 2024 · 13 comments

Comments

@JonnyTech
Copy link

I have a USB video capture device. Can access it with ffmpeg, vlc, etc. How would I use that as an input source for Mist?

@Rokamun
Copy link
Contributor

Rokamun commented Sep 7, 2024 via email

@JonnyTech
Copy link
Author

Thank you Balder @Rokamun

ts-exec:ffmpeg COMMAND -f mpegts -
or
mkv-exec:ffmpeg COMMAND -f matroska -

But I do not understand how to use these commands. Should I have commands called ts-exec and mkv-exec? Because they do not exist on my system.

I found these, are they useful or a should I be doing something else?:

$ MistProcFFMPEG --help
Usage: MistProcFFMPEG [options] [configuration]

configuration   (string) JSON configuration, or - (default) to read from stdin
--debug, -g     (integer) The debug level at which messages need to be printed.
--help, -h      Display usage and version information, then exit.
--json, -j      Output connector info in JSON format, then exit.
--version, -v   Display library and application version, then exit.
Version: 3.4, release Free_64
Built on Jul 31 2024, 12:56:41

$ MistInTS --help
Usage: MistInTS [options] [input] [output]

--datatrack, -D     (string) Which parser to use for data tracks
--debug, -g         (integer) The debug level at which messages need to be printed.
--headerOnly, -H    Generate .dtsh, then exit
--help, -h          Display usage and version information, then exit.
input               (string) Name of the input file or - for stdin
--inputtimeout, -i  (integer) Time in seconds to keep the input process loaded without activity
--json, -j          Output MistIn info in JSON format, then exit
output              (string) Name of the output file or - for stdout
--pagetimeout, -P   (integer) For bufferless or live inputs like HLS, set the timeout in seconds for old, inactive pages to be deleted. A longer value results in more memory usage, but ensures that recently buffered data stays in memory for longer
--raw, -R           Enable raw MPEG-TS passthrough mode
--realtime, -r      Feed the results of this input in realtime to the buffer
--stream, -s        (string) The name of the stream that this connector will provide in player mode
--version, -v       Display library and application version, then exit.
Version: 3.4, release Free_64
Built on Jul 31 2024, 12:56:41

Mist was installed from mistserver_64V3.4.tar.gz and the web interface shows Version:3.4 Free_64.

Should I be running another version? I can also use Windows if that is easier.

@Rokamun
Copy link
Contributor

Rokamun commented Sep 8, 2024 via email

@JonnyTech
Copy link
Author

Rokamun commented via email
As an example:
[image: image.png]

When posting via email, GitHub strips all attachments and images.

Are you able to post your message directly at #204 so that I can see the image, please?

If I understand correctly, I use my ffmpeg command and then another within the videogen script? Can I just use a single one?

@JonnyTech
Copy link
Author

I followed the instructions from the linked page and created the file:

$ cat /usr/local/bin/videogen 
#!/bin/bash

ffmpeg -re -f lavfi -i "aevalsrc=if(eq(floor(t)\,ld(2))\,st(0\,random(4)*3000+1000))\;st(2\,floor(t)+1)\;st(1\,mod(t\,1))\;(0.6*sin(1*ld(0)*ld(1))+0.4*sin(2*ld(0)*ld(1)))*exp(-4*ld(1)) [out1]; testsrc=s=800x600,drawtext=borderw=5:fontcolor=white:fontsize=30:text='%{localtime}/%{pts\:hms}':x=\(w-text_w\)/2:y=\(h-text_h-line_h\)/2 [out0]" \
-acodec aac -vcodec h264 -strict -2 -pix_fmt yuv420p -profile:v baseline -level 3.0 \
$@

Then added the stream in the web interface:

image

But get this error:

image

So I try videogen from the command line:

$ videogen -f rtsp rtsp://127.0.0.1:5554/teststream
ffmpeg version 6.1.1-1~mx23+1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr --extra-version='1~mx23+1' --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-libharfbuzz --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --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 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libvpl --disable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libsvtav1 --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, lavfi, from 'aevalsrc=if(eq(floor(t)\,ld(2))\,st(0\,random(4)*3000+1000))\;st(2\,floor(t)+1)\;st(1\,mod(t\,1))\;(0.6*sin(1*ld(0)*ld(1))+0.4*sin(2*ld(0)*ld(1)))*exp(-4*ld(1)) [out1]; testsrc=s=800x600,drawtext=borderw=5:fontcolor=white:fontsize=30:text='%{localtime}/%{pts\:hms}':x=\(w-text_w\)/2:y=\(h-text_h-line_h\)/2 [out0]':
  Duration: N/A, start: 0.000000, bitrate: 2822 kb/s
  Stream #0:0: Video: wrapped_avframe, rgb24, 800x600 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
  Stream #0:1: Audio: pcm_f64le, 44100 Hz, mono, dbl, 2822 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_f64le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x55758b295b80] using SAR=1/1
[libx264 @ 0x55758b295b80] frame MB size (50x38) > level limit (1620)
[libx264 @ 0x55758b295b80] MB rate (47500) > level limit (40500)
[libx264 @ 0x55758b295b80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55758b295b80] profile Constrained Baseline, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x55758b295b80] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[out#0/rtsp @ 0x55758b2969c0] Could not write header (incorrect codec parameters ?): Invalid data found when processing input
Error while filtering: Invalid data found when processing input
[out#0/rtsp @ 0x55758b2969c0] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
[aac @ 0x55758b26e7c0] Qavg: 107.666
Conversion failed!

The script produces a valid output because I can send it to a file correctly:

$ videogen -t 3 /tmp/test3sec.mp4 

In the web interface, I deleted all protocols and enabled default protocols. No change. Any idea what I am doing wrong?

@Rokamun
Copy link
Contributor

Rokamun commented Sep 9, 2024

Heya,

Wasn't aware images wouldn't load in properly when answering by mail. I'll add the picture here just as well.
Guess that's my bad hoping that the email integration would actually work.

Previous picture:
vidgen_in_source
Though that said you've already figured that one out yourself.

Looking at the script it's identical to the one I'm using:

#!/bin/bash

ffmpeg -re -f lavfi -i "aevalsrc=if(eq(floor(t)\,ld(2))\,st(0\,random(4)*3000+1000))\;st(2\,floor(t)+1)\;st(1\,mod(t\,1))\;(0.6*sin(1*ld(0)*ld(1))+0.4*sin(2*ld(0)*ld(1)))*exp(-4*ld(1)) [out1]; testsrc=s=800x600,drawtext=borderw=5:fontcolor=white:fontsize=30:text='%{localtime}/%{pts\:hms}':x=\(w-text_w\)/2:y=\(h-text_h-line_h\)/2 [out0]" \
-acodec aac -vcodec h264 -strict -2 -pix_fmt yuv420p -profile:v baseline -level 3.0 \
$@

The only addition I've got is -g 25 however all that does is force the keyframe interval to once per second. So that shouldn't have impact on the script working or not.

I am using an ffmpeg version of 7.0.2.

if I look at the log warnings under your preview. I'm suspecting there might be a process hogging or locking up the input for your stream. The message about the input being not configured or unavailable usually points to that being the case.
It is most likely best to just reset MistServer and try again. A full proper restart can be done through:

systemctl stop mistserver
rm /dev/shm/*Mst*
systemctl start mistserver

Optionally, after stopping MistServer run:

ps aux|grep Mist
verify if there's any processes left running. If so, just kill -9 them.

Another method of verifying whether this is the problem would be creating a new stream and seeing if the script does work there.

Another alternative would be going to mkv-exec. It would basically do the same, but work with Matroska which is a bit more forgiving when it comes to codec support. Which would change the syntax slightly:

mkv-exec:ffmpeg COMMAND -f matroska -

@JonnyTech
Copy link
Author

Thank you for your continued assistance.

I am using an ffmpeg version of 7.0.2.

I am using latest build too: ffmpeg version N-116931-g8517ff2082-20240908 Copyright (c) 2000-2024 the FFmpeg developers built with gcc 14.2.0 (crosstool-NG 1.26.0.106_ed12fa6)

Reset server:

$ sudo service mistserver stop
Stopping MistServer MistController
Success

$ ps aux|grep Mist
user       65299  0.0  0.0  75980  2136 pts/2    S+   10:52   0:00 grep Mist

# That is just my grep command :)

$ ls /dev/shm/*Mst*
/dev/shm/MstExtWriters

$ sudo rm /dev/shm/*Mst*

$ sudo service mistserver start
Starting MistServer MistController
Success

Which would change the syntax slightly:
mkv-exec:ffmpeg COMMAND -f matroska -

I hope that you don't mind the pictures, it is easier to show than write:

image

image

image

image

Make sure the command works:

$ /usr/local/bin/videogen -f matroska - | ~/ffplay -

image

Can I supply any other logs?

@Rokamun
Copy link
Contributor

Rokamun commented Sep 9, 2024

Hmm,

One last thing I can think of is adding the path to the script. I wouldn't know why, but perhaps it isn't finding the script properly. So could you try adding the /usr/local/bin/ to the source input?

mkv-exec:/usr/local/bin/videogen -f matroska -

Shouldn't be needed though, assuming MistServer runs as root it should find that as well..

Logs
What you can try is setting the logs to level 4. Nuke the stream from the status panel and then retry opening it. That should spawn more usable logs about what is going on in the logs.

The logs themselves you can grab using:
journalctl --since=-10m -u mistserver

Alternatively, we can just push

You sort of tried this using RTSP already, but we can also just push the streaming data into MistServer if the stream source is set to push://. It'll be a tad slower as it's faster for the ingest to just directly input from ffmpeg, but I can't spot why that isn't working in your case.

Once set to push, you can push into it using:

-f mpegts srt://localhost:8889?streamid=streamname
-f flv rtmp://localhost/live/streamname
or
-f rtsp rtsp://localhost:5554/streamname

@JonnyTech
Copy link
Author

mkv-exec:/usr/local/bin/videogen -f matroska -

No change

The logs themselves you can grab using: journalctl --since=-10m -u mistserver

$ sudo  journalctl --since=-10m -u mistserver
No journal files were found.
-- No entries --

Once set to push, you can push into it using:

SRT:

$ ~/ffmpeg -re -f lavfi -i "aevalsrc=if(eq(floor(t)\,ld(2))\,st(0\,random(4)*3000+1000))\;st(2\,floor(t)+1)\;st(1\,mod(t\,1))\;(0.6*sin(1*ld(0)*ld(1))+0.4*sin(2*ld(0)*ld(1)))*exp(-4*ld(1)) [out1]; testsrc=s=800x600,drawtext=borderw=5:fontcolor=white:fontsize=30:text='%{localtime}/%{pts\:hms}':x=\(w-text_w\)/2:y=\(h-text_h-line_h\)/2 [out0]" -acodec aac -vcodec h264 -strict -2 -pix_fmt yuv420p -profile:v baseline -level 3.0 -f mpegts srt://localhost:8889?streamid=streamname
ffmpeg version N-116931-g8517ff2082-20240908 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14.2.0 (crosstool-NG 1.26.0.106_ed12fa6)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-libxml2 --enable-openssl --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-libzmq --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libvvenc --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs='-ldl -lgomp' --extra-ldflags=-pthread --extra-ldexeflags=-pie --cc=x86_64-ffbuild-linux-gnu-gcc --cxx=x86_64-ffbuild-linux-gnu-g++ --ar=x86_64-ffbuild-linux-gnu-gcc-ar --ranlib=x86_64-ffbuild-linux-gnu-gcc-ranlib --nm=x86_64-ffbuild-linux-gnu-gcc-nm --extra-version=20240908
  libavutil      59. 36.100 / 59. 36.100
  libavcodec     61. 13.100 / 61. 13.100
  libavformat    61.  5.101 / 61.  5.101
  libavdevice    61.  2.100 / 61.  2.100
  libavfilter    10.  2.102 / 10.  2.102
  libswscale      8.  2.100 /  8.  2.100
  libswresample   5.  2.100 /  5.  2.100
  libpostproc    58.  2.100 / 58.  2.100
Input #0, lavfi, from 'aevalsrc=if(eq(floor(t)\,ld(2))\,st(0\,random(4)*3000+1000))\;st(2\,floor(t)+1)\;st(1\,mod(t\,1))\;(0.6*sin(1*ld(0)*ld(1))+0.4*sin(2*ld(0)*ld(1)))*exp(-4*ld(1)) [out1]; testsrc=s=800x600,drawtext=borderw=5:fontcolor=white:fontsize=30:text='%{localtime}/%{pts\:hms}':x=\(w-text_w\)/2:y=\(h-text_h-line_h\)/2 [out0]':
  Duration: N/A, start: 0.000000, bitrate: 2822 kb/s
  Stream #0:0: Video: wrapped_avframe, rgb24, 800x600 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
  Stream #0:1: Audio: pcm_f64le, 44100 Hz, mono, dbl, 2822 kb/s
[srt @ 0x55d0f8d34700] Connection to srt://localhost:8889?streamid=streamname failed (Input/output error), trying next address
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_f64le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x55d0f8d38a40] using SAR=1/1
[libx264 @ 0x55d0f8d38a40] frame MB size (50x38) > level limit (1620)
[libx264 @ 0x55d0f8d38a40] MB rate (47500) > level limit (40500)
[libx264 @ 0x55d0f8d38a40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55d0f8d38a40] profile Constrained Baseline, level 3.0, 4:2:0, 8-bit
Output #0, mpegts, to 'srt://localhost:8889?streamid=streamname':
  Metadata:
    encoder         : Lavf61.5.101
  Stream #0:0: Video: h264, yuv420p(tv, progressive), 800x600 [SAR 1:1 DAR 4:3], q=2-31, 25 fps, 90k tbn
      Metadata:
        encoder         : Lavc61.13.100 libx264
      Side data:
        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC), 44100 Hz, mono, fltp, 69 kb/s
      Metadata:
        encoder         : Lavc61.13.100 aac
[vost#0:0/libx264 @ 0x55d0f8d38540] Error submitting a packet to the muxer: Input/output error    
    Last message repeated 1 times
[out#0/mpegts @ 0x55d0f8d37700] Error muxing a packet
[out#0/mpegts @ 0x55d0f8d37700] Task finished with error code: -5 (Input/output error)
[out#0/mpegts @ 0x55d0f8d37700] Terminating thread with return code -5 (Input/output error)
[out#0/mpegts @ 0x55d0f8d37700] Error writing trailer: Input/output error
[out#0/mpegts @ 0x55d0f8d37700] Error closing file: Input/output error
[out#0/mpegts @ 0x55d0f8d37700] video:23KiB audio:22KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=    7 fps=3.2 q=-1.0 Lsize=      24KiB time=00:00:00.28 bitrate= 692.9kbits/s speed=0.128x    
[libx264 @ 0x55d0f8d38a40] frame I:1     Avg QP:14.73  size: 17978
[libx264 @ 0x55d0f8d38a40] frame P:65    Avg QP:18.95  size:   804
[libx264 @ 0x55d0f8d38a40] mb I  I16..4: 86.2%  0.0% 13.8%
[libx264 @ 0x55d0f8d38a40] mb P  I16..4:  2.2%  0.0%  0.1%  P16..4:  6.5%  0.9%  0.4%  0.0%  0.0%    skip:89.8%
[libx264 @ 0x55d0f8d38a40] coded y,uvDC,uvAC intra: 6.3% 22.4% 11.0% inter: 0.4% 2.8% 0.6%
[libx264 @ 0x55d0f8d38a40] i16 v,h,dc,p: 78% 11%  2%  8%
[libx264 @ 0x55d0f8d38a40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 22% 20%  5%  3%  4%  2%  5%  3%
[libx264 @ 0x55d0f8d38a40] i8c dc,h,v,p: 35% 16% 41%  8%
[libx264 @ 0x55d0f8d38a40] ref P L0: 79.6% 13.2%  7.2%
[libx264 @ 0x55d0f8d38a40] kb/s:212.83
[aac @ 0x55d0f8d32ec0] Qavg: 3318.028
Conversion failed!

Mist log:

Mon 09 Sep 2024, 16:05:39	WARN	Could not get stream 'streamname' config!
Mon 09 Sep 2024, 16:05:39	WARN	Could not get stream 'streamname' config!
Mon 09 Sep 2024, 16:05:39	FAIL	onFail 'streamname': Stream open failed
Mon 09 Sep 2024, 16:05:39	FAIL	onFail 'streamname': Could not connect to stream data
Mon 09 Sep 2024, 16:05:39	FAIL	Push rejected - stream streamname not configured or unavailable

RTMP:

$ ~/ffmpeg -re -f lavfi -i "aevalsrc=if(eq(floor(t)\,ld(2))\,st(0\,random(4)*3000+1000))\;st(2\,floor(t)+1)\;st(1\,mod(t\,1))\;(0.6*sin(1*ld(0)*ld(1))+0.4*sin(2*ld(0)*ld(1)))*exp(-4*ld(1)) [out1]; testsrc=s=800x600,drawtext=borderw=5:fontcolor=white:fontsize=30:text='%{localtime}/%{pts\:hms}':x=\(w-text_w\)/2:y=\(h-text_h-line_h\)/2 [out0]" -acodec aac -vcodec h264 -strict -2 -pix_fmt yuv420p -profile:v baseline -level 3.0 -f flv rtmp://localhost/live/streamname
ffmpeg version N-116931-g8517ff2082-20240908 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14.2.0 (crosstool-NG 1.26.0.106_ed12fa6)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-libxml2 --enable-openssl --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-libzmq --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libvvenc --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs='-ldl -lgomp' --extra-ldflags=-pthread --extra-ldexeflags=-pie --cc=x86_64-ffbuild-linux-gnu-gcc --cxx=x86_64-ffbuild-linux-gnu-g++ --ar=x86_64-ffbuild-linux-gnu-gcc-ar --ranlib=x86_64-ffbuild-linux-gnu-gcc-ranlib --nm=x86_64-ffbuild-linux-gnu-gcc-nm --extra-version=20240908
  libavutil      59. 36.100 / 59. 36.100
  libavcodec     61. 13.100 / 61. 13.100
  libavformat    61.  5.101 / 61.  5.101
  libavdevice    61.  2.100 / 61.  2.100
  libavfilter    10.  2.102 / 10.  2.102
  libswscale      8.  2.100 /  8.  2.100
  libswresample   5.  2.100 /  5.  2.100
  libpostproc    58.  2.100 / 58.  2.100
Input #0, lavfi, from 'aevalsrc=if(eq(floor(t)\,ld(2))\,st(0\,random(4)*3000+1000))\;st(2\,floor(t)+1)\;st(1\,mod(t\,1))\;(0.6*sin(1*ld(0)*ld(1))+0.4*sin(2*ld(0)*ld(1)))*exp(-4*ld(1)) [out1]; testsrc=s=800x600,drawtext=borderw=5:fontcolor=white:fontsize=30:text='%{localtime}/%{pts\:hms}':x=\(w-text_w\)/2:y=\(h-text_h-line_h\)/2 [out0]':
  Duration: N/A, start: 0.000000, bitrate: 2822 kb/s
  Stream #0:0: Video: wrapped_avframe, rgb24, 800x600 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
  Stream #0:1: Audio: pcm_f64le, 44100 Hz, mono, dbl, 2822 kb/s
[out#0/flv @ 0x560e84ab8e00] Error opening output rtmp://localhost/live/streamname: Input/output error
Error opening output file rtmp://localhost/live/streamname.
Error opening output files: Input/output error

Logs

Mon 09 Sep 2024, 16:08:18	FAIL	Push rejected - stream streamname not configured or unavailable
Mon 09 Sep 2024, 16:08:18	FAIL	onFail 'streamname': Could not connect to stream data
Mon 09 Sep 2024, 16:08:18	FAIL	onFail 'streamname': Stream open failed
Mon 09 Sep 2024, 16:08:18	WARN	Could not get stream 'streamname' config!
Mon 09 Sep 2024, 16:08:18	WARN	Could not get stream 'streamname' config!

RTSP:

$ ~/ffmpeg -re -f lavfi -i "aevalsrc=if(eq(floor(t)\,ld(2))\,st(0\,random(4)*3000+1000))\;st(2\,floor(t)+1)\;st(1\,mod(t\,1))\;(0.6*sin(1*ld(0)*ld(1))+0.4*sin(2*ld(0)*ld(1)))*exp(-4*ld(1)) [out1]; testsrc=s=800x600,drawtext=borderw=5:fontcolor=white:fontsize=30:text='%{localtime}/%{pts\:hms}':x=\(w-text_w\)/2:y=\(h-text_h-line_h\)/2 [out0]" -acodec aac -vcodec h264 -strict -2 -pix_fmt yuv420p -profile:v baseline -level 3.0  -f rtsp rtsp://localhost:5554/streamname
ffmpeg version N-116931-g8517ff2082-20240908 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14.2.0 (crosstool-NG 1.26.0.106_ed12fa6)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-libxml2 --enable-openssl --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-libzmq --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libvvenc --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs='-ldl -lgomp' --extra-ldflags=-pthread --extra-ldexeflags=-pie --cc=x86_64-ffbuild-linux-gnu-gcc --cxx=x86_64-ffbuild-linux-gnu-g++ --ar=x86_64-ffbuild-linux-gnu-gcc-ar --ranlib=x86_64-ffbuild-linux-gnu-gcc-ranlib --nm=x86_64-ffbuild-linux-gnu-gcc-nm --extra-version=20240908
  libavutil      59. 36.100 / 59. 36.100
  libavcodec     61. 13.100 / 61. 13.100
  libavformat    61.  5.101 / 61.  5.101
  libavdevice    61.  2.100 / 61.  2.100
  libavfilter    10.  2.102 / 10.  2.102
  libswscale      8.  2.100 /  8.  2.100
  libswresample   5.  2.100 /  5.  2.100
  libpostproc    58.  2.100 / 58.  2.100
Input #0, lavfi, from 'aevalsrc=if(eq(floor(t)\,ld(2))\,st(0\,random(4)*3000+1000))\;st(2\,floor(t)+1)\;st(1\,mod(t\,1))\;(0.6*sin(1*ld(0)*ld(1))+0.4*sin(2*ld(0)*ld(1)))*exp(-4*ld(1)) [out1]; testsrc=s=800x600,drawtext=borderw=5:fontcolor=white:fontsize=30:text='%{localtime}/%{pts\:hms}':x=\(w-text_w\)/2:y=\(h-text_h-line_h\)/2 [out0]':
  Duration: N/A, start: 0.000000, bitrate: 2822 kb/s
  Stream #0:0: Video: wrapped_avframe, rgb24, 800x600 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
  Stream #0:1: Audio: pcm_f64le, 44100 Hz, mono, dbl, 2822 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_f64le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x560bac8d73c0] using SAR=1/1
[libx264 @ 0x560bac8d73c0] frame MB size (50x38) > level limit (1620)
[libx264 @ 0x560bac8d73c0] MB rate (47500) > level limit (40500)
[libx264 @ 0x560bac8d73c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x560bac8d73c0] profile Constrained Baseline, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x560bac8d73c0] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2024 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[out#0/rtsp @ 0x560bac8d6d40] Could not write header (incorrect codec parameters ?): Invalid data found when processing input
[vf#0:0 @ 0x560bac8f9480] Error sending frames to consumers: Invalid data found when processing input
[vf#0:0 @ 0x560bac8f9480] Task finished with error code: -1094995529 (Invalid data found when processing input)
[vf#0:0 @ 0x560bac8f9480] Terminating thread with return code -1094995529 (Invalid data found when processing input)
[out#0/rtsp @ 0x560bac8d6d40] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A    
[aac @ 0x560bac8d9b40] Qavg: 7710.881
Conversion failed!

Logs

Mon 09 Sep 2024, 16:09:43	WARN	Could not get stream 'streamname' config!
Mon 09 Sep 2024, 16:09:43	WARN	Could not get stream 'streamname' config!
Mon 09 Sep 2024, 16:09:43	FAIL	onFail 'streamname': Stream open failed
Mon 09 Sep 2024, 16:09:43	FAIL	onFail 'streamname': Could not connect to stream data
Mon 09 Sep 2024, 16:09:43	FAIL	Push rejected - stream streamname not configured or unavailable

Is there another build that I could try?

@JonnyTech
Copy link
Author

image

Should I be worried about disabled protocols?

@Rokamun
Copy link
Contributor

Rokamun commented Sep 9, 2024

The disabled protocols aren't a problem, all of those require manual input to get to work so they cannot be automatically activated.

How are you running MistServer however? If you're running it by booting up directly MistController I'd understand the logs not being there, or possibly you're running it on an OS that has systemd logging disabled bye default?

Pushes
For the live push I meant for you to push towards a stream name you've set up.
For example this one:
image

To which you'd use livestreamtest instead of streamname
All of those push attemps will have failed because the stream streamname does not exist in your system with a source accepting incoming pushes.
Mon 09 Sep 2024, 16:08:18 FAIL Push rejected - stream streamname not configured or unavailable is telling you this.

As an example endpoint you could try pushing to one of our testing servers using:
rtmp://patchy.ddvtech.com/live/livestreamtest
and
srt://patchy.ddvtech.com:8889?streamid=livestreamtest

The playback url for this would be:
https://patchy.ddvtech.com/mist/livestreamtest.html

You'll have to bring up a bit of patience for that server, it is quite slow.

Version
You can always try the previous 3.3 version of MistServer if you'd prefer:
https://r.mistserver.org/dl/mistserver_64V3.3.tar.gz

or as script:
curl -o - https://releases.mistserver.org/is/mistserver_64V3.3.tar.gz 2>/dev/null | sh

@JonnyTech
Copy link
Author

Aha! I have setup a push:// stream and now I can push to it - thank you!

possibly you're running it on an OS that has systemd logging disabled bye default?

My init system is sysVinit, not systemd.

You sort of tried this using RTSP already, but we can also just push the streaming data into MistServer if the stream source is set to push://. It'll be a tad slower as it's faster for the ingest to just directly input from ffmpeg, but I can't spot why that isn't working in your case.

I did not understand the process before, but your patience has certainly educated me.

So the missing link is the videogen ingest. I would love to get that working, seeing as you say that pushing is slower.

@Rokamun
Copy link
Contributor

Rokamun commented Sep 11, 2024

It is indeed slower, though the measure of it is within the keyframe interval of things and it is startup related, once running it "should" be about the same. The biggest slowdown is most likely the ffmpeg buffer in this, but it would be present in both methods.

Though it is still weird to me that TS/MKV-exec as source input doesn't work...
Since you mentioned sysVinit, what OS are you using? I might've missed it if you mentioned it before. I'd love to do some tests to verify things.

The last thing you can try to possibly debug the why the process might not be working is to run it manually from the terminal:

MistInEBML -s test -g 6 'mkv-exec:videogen -f matroska -'

That should boot it in the terminal and hopefully give some sensible feedback as to what might be going wrong.
(The -s test part of the command makes it create a stream test which will most likely not show up in the preview pages if it does work. But seeing as the bootup of the command fails that should be fine. No need to create a stream test for this command)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants