Closed obertugo closed 6 months ago
I didn't get a chance to test on Linux, so the default option is missing in the current version. However, you can pass your own string if you familiar with ffmpeg
via the command line, for example, on Windows you can use
dlna-cast screen --dlna_device BF913C44 --input_opts '-f dshow -i video="screen-capture-recorder":audio="virtual-audio-capturer"'
According to ChatGPT, possible options are:
-f x11grab -i :0.0 -f pulse -ac 2 -i default
-f x11grab -i :0.0 -f alsa -ac 2 -i hw:0,0
You may use arecord -l
to check available devices.
Hello again link89, thanks for your prompt response, the part of the code that generates the empty string error, I think it expects the name of the ffmpeg executable,; I have tried to pass it with: export FFMPEG_BIN=/usr/bin/ffmpeg and nothing has changed, perhaps due to the difference in the naming between Windows \ / Linux and the slash / and the backslash \ ... And again my thanks in advance. I'm going to try his suggestions and let him know when I get back from work...
Greetings link89, thanks for your quick response, I tried before going to work:
dlna-cast screen --dlna_device BF913C44 --input_opts '-f x11grab -i :0.0 -f alsa -ac 2 -i hw:0,0'
And this is the result:
HTTP: start to serve at port 35859
Traceback (most recent call last):
File "/home/tugo/.local/bin/dlna-cast", line 8, in
It looks like fire
fail to parse the args correctly. Please try this way (add =
)
dlna-cast screen --dlna_device BF913C44 --input_opts='-f x11grab -i :0.0 -f alsa -ac 2 -i hw:0,0'
Sorry but I made a mistake when copying your suggestion, the command without single quotes:
dlna-cast screen --dlna_device BF913C44 --input_opts -f x11grab -i :0.0 -f alsa -ac 2 -i hw:0.0
Returns:
HTTP: start to serve at port 33707
run command: /usr/bin/ffmpeg -framerate alsa hw:0,0 -c:v libx264 -preset fast -tune zerolatency -crf 21 -vf format=yuv420p -keyint_min:v 1 -force_key_frames:v "expr:gte( t,n_forced2)" -f hls -hls_time 2 -hls_list_size 10 -hls_flags delete_segments /home/tugo/dlna-cast/index.m3u8
Traceback (most recent call last):
File "/home/tugo/.local/bin/dlna-cast", line 8, in
Trying with the command:
dlna-cast screen --dlna_device BF913C44 --input_opts='-f x11grab -i :0.0 -f alsa -ac 2 -i hw:0,0'
Result:
dlna-cast screen --dlna_device BF913C44 --input_opts='-f x11grab -i :0.0 -f alsa -ac 2 -i hw:0,0'
HTTP: start to serve at port 38979
run command: /usr/bin/ffmpeg -framerate 30 -f x11grab -i :0.0 -f alsa -ac 2 -i hw:0,0 -c:v libx264 -preset fast -tune zerolatency -crf 21 -vf format= yuv420p -keyint_min:v 1 -force_key_frames:v "expr:gte(t,n_forced2)" -f hls -hls_time 2 -hls_list_size 10 -hls_flags delete_segments /home/tugo/dlna-cast/index.m3u8
Traceback (most recent call last):
File "/home/tugo/.local/bin/dlna-cast", line 8, in
And finally, from the same command above, but without the single quotes:
dlna-cast screen --dlna_device BF913C44 --input_opts=-f x11grab -i :0.0 -f alsa -ac 2 -i hw:0.0
Result:
HTTP: start to serve at port 43937
run command: /usr/bin/ffmpeg -framerate alsa hw:0,0 -c:v libx264 -preset fast -tune zerolatency -crf 21 -vf format=yuv420p -keyint_min:v 1 -force_key_frames:v "expr:gte( t,n_forcedx11grab)" -f hls -hls_time x11grab -hls_list_size 10 -hls_flags delete_segments /home/tugo/dlna-cast/index.m3u8
Traceback (most recent call last):
File "/home/tugo/.local/bin/dlna-cast", line 8, in
I am very interested in having this work on linux as well. Unfortunately, I cannot help you with the coding, but if you need a tester, hit me up.
Hello link89, I am not a Python programmer, but if you tell me what to do, to debug your program, I will be happy to undertake the task.
I tell you, I ran your program a while ago, in a super user or root session and the result is the same, the index.m3u8 file is not generated.
I am also very interested in your program running on Linux.
Well, waiting for your response, I greet you sincerely...
I just release a new version 0.1.6 to provide default input options for Linux without audio. I have test this on a Ubuntu 22.04. You may try this new version with pip install -U dlna-cast
and see if it works for you.
@obertugo @emk2203
Greetings @link89 and I can confirm that the program now works, on Void Linux i686 32 bits. Thank you so much !!!
Hello and thank you in advance for having done dlna-cast... I have installed with: pip install dlna-cast The program detects my DLNA device perfectly. The problem arises when I try to run: dlna-cast screen --dlna_device BF913C44 I think the program cannot find my ffmpeg, this is the error trace: File "/home/tugo/.local/pipx/venvs/dlna-cast/lib/python3.12/site-packages/dlna_cast/main.py", line 112, in screen self._start_ffmpeg_streaming(framerate, input_opts, segment_size, crf) File "/home/tugo/.local/pipx/venvs/dlna-cast/lib/python3.12/site-packages/dlna_cast/main.py", line 82, in _start_ffmpeg_streaming cmd = ' '.join(cmd) ^^^^^^^^^^^^^ TypeError: sequence item 3: expected str instance, NoneType found
Waiting for your prompt attention, I remain at your service to provide you with any details that seem pertinent, again, thank you...!