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

Decklink output #109

Closed
tvadi opened this issue Jan 14, 2022 · 35 comments
Closed

Decklink output #109

tvadi opened this issue Jan 14, 2022 · 35 comments

Comments

@tvadi
Copy link

tvadi commented Jan 14, 2022

I can see the stream in VLC on rtmp://192.168.1.xxx/live/stream <- playing file 720ts_6DK01H_tru720og.ts and 720ts_.ts- same file as the other, just renamed and both are on loop.

I can output video directly from ffmpeg out the Decklink SDI with:
ffmpeg -i /home/matt/VideoTests/720ts_6DK01H_tru720og.ts -pix_fmt yuv420p -f decklink -vcodec v210 "DeckLink SDI 4K"

Trying now to get the ffplayout to output on decklink, I tried your recommended:
ffmpeg_param: >- -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset medium -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k stream_output: >- -flags +global_header -f flv rtmp://localhost/live/stream -pix_fmt uyvy422 -vcodec v210 -f decklink "DeckLink SDI 4K"

Unfortunately nothing out the decklink.. Log:

[2022-01-14 09:28:46,298] [DEBUG]  -------------------------------------------------------------------------------
[2022-01-14 09:28:47,710] [DEBUG]  Encoder CMD: "ffmpeg -v level+error -hide_banner -nostats -re -thread_queue_size 160 -i pipe:0 -metadata service_name=Live Stream -metadata service_provider=example.org -metadata year=2022 -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset medium -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +global_header -f flv rtmp://localhost/live/stream  -pix_fmt uyvy422 -vcodec v210 -f decklink "DeckLink SDI 4K""
[2022-01-14 09:28:47,713] [INFO]  Open: /opt/playlists/2022/01/2022-01-14.json
[2022-01-14 09:28:47,715] [DEBUG]  List init
[2022-01-14 09:28:47,736] [INFO]  Play: /opt/tv-media/720ts_.ts
[2022-01-14 09:28:47,736] [DEBUG]  Decoder CMD: "ffmpeg -v level+error -hide_banner -nostats -ss 46.539 -i /opt/tv-media/720ts_.ts -filter_complex [0:v]fps=25,scale=1024:576,tpad=stop_mode=add:stop_duration=0.8483936670000389,fade=in:st=0:d=0.5[v];[v]null[vout1] -filter_complex [0:a]anull,apad=whole_dur=146.01757166700003,afade=in:st=0:d=0.5[aout1] -map [vout1] -map [aout1] -pix_fmt yuv420p -r 25 -c:v mpeg2video -g 1 -b:v 58982.4k -minrate 58982.4k -maxrate 58982.4k -bufsize 29491.2k -c:a s302m -strict -2 -ar 48000 -ac 2 -f mpegts -"
[2022-01-14 09:28:47,983] [ERROR]  Broken Pipe!
[2022-01-14 09:28:47,983] [DEBUG]  -------------------------------------------------------------------------------
[2022-01-14 09:28:47,983] [DEBUG]  error: "[Errno 32] Broken pipe"
[2022-01-14 09:28:47,983] [DEBUG]  delta: "0"
[2022-01-14 09:28:47,984] [DEBUG]  node: "{'source': '/opt/tv-media/720ts_.ts', 'in': 0, 'out': 192.55657166700001, 'duration': 192.55657166700001, 'category': '', 'seek': 46.539, 'begin': 34081.177158354956, 'number': 66, 'probe': , 'src_cmd': ['-ss', '46.539', '-i', '/opt/tv-media/720ts_.ts'], 'filter': ['-filter_complex', '[0:v]fps=25,scale=1024:576,tpad=stop_mode=add:stop_duration=0.8483936670000389,fade=in:st=0:d=0.5[v];[v]null[vout1]', '-filter_complex', '[0:a]anull,apad=whole_dur=146.01757166700003,afade=in:st=0:d=0.5[aout1]', '-map', '[vout1]', '-map', '[aout1]']}"
[2022-01-14 09:28:47,984] [DEBUG]  dec_cmd: "['ffmpeg', '-v', 'level+error', '-hide_banner', '-nostats', '-ss', '46.539', '-i', '/opt/tv-media/720ts_.ts', '-filter_complex', '[0:v]fps=25,scale=1024:576,tpad=stop_mode=add:stop_duration=0.8483936670000389,fade=in:st=0:d=0.5[v];[v]null[vout1]', '-filter_complex', '[0:a]anull,apad=whole_dur=146.01757166700003,afade=in:st=0:d=0.5[aout1]', '-map', '[vout1]', '-map', '[aout1]', '-pix_fmt', 'yuv420p', '-r', '25', '-c:v', 'mpeg2video', '-g', '1', '-b:v', '58982.4k', '-minrate', '58982.4k', '-maxrate', '58982.4k', '-bufsize', '29491.2k', '-c:a', 's302m', '-strict', '-2', '-ar', '48000', '-ac', '2', '-f', 'mpegts', '-']"
[2022-01-14 09:28:47,984] [DEBUG]  -------------------------------------------------------------------------------

decode:
[2022-01-14 10:11:22,533] Error writing trailer of pipe:: Broken pipe [2022-01-14 10:11:24,409] av_interleaved_write_frame(): Broken pipe

encode:
[2022-01-14 10:11:24,408] [NULL @ 0x55ec92de8600] Unable to find a suitable output format for 'SDI' [2022-01-14 10:11:24,408] SDI: Invalid argument

@tvadi
Copy link
Author

tvadi commented Jan 14, 2022

In looking at the log I am trying some changes but still no luck unfortunately..

In config, changed Width: 1280, Hight: 720, FPS: 59.94, aspect: 1.000

ffmpeg_param:
-c:v mpeg2video -g 1 -b:v 58982.4k -maxrate 9000k -bufsize 18000k -pix_fmt yuv420p -c:a s302m -strict -2 -ar 48000 -ac 2 -f mpegts

stream_output:
-flags +global_header -f flv rtmp://localhost/live/stream -pix_fmt yuv420p -vcodec v210 -f decklink "DeckLink SDI 4K"

Please let me know if you have any ideas, I will ask on the ffmpeg email forum too.. Thanks!

@tvadi
Copy link
Author

tvadi commented Jan 14, 2022

Found the output page. https://github.com/ffplayout/ffplayout_engine/wiki/Outputs Hoping to get a little more info, is there a sample of the python file to be made with the ffplayout/output/ with an output() function in it? Then what do you put in the ffmpeg_param field/ edit the ffplayout.yml config?

@jb-alvarado
Copy link
Member

jb-alvarado commented Jan 15, 2022

Aspect of one is not correct, for 16:9 you should leaf this untouched.

I think the string quotation from output was not preserved. Can you download the zip from master branch and override /opt/ffplayout_engine? And try again?

When you override this folder, you have to fix the config also. In /etc/ffplayout/ffplayout.yml You need to change:

smpt_server -> smtp_server
smpt_port -> smtp_port

@tvadi
Copy link
Author

tvadi commented Jan 15, 2022

Changed aspect back to 1.778
Renamed /opt/ffplayout_engine to ffplayout_engine_old
Downloaded ffplayout_engine-master.zip unzipped and renamed to ffplayout_engine and placed in /opt
Edited /etc/ffplayout/ffplayout.yml

smpt_server -> smtp_server smpt_port -> smtp_port

Player page now shows no clip loaded and no duration moving..

@tvadi
Copy link
Author

tvadi commented Jan 15, 2022

Since you don't have a decklink card, if you ever wanted to Zoom/ remote into this test server, we could set that up and soon as I get some money coming in I am hoping to sponsor you. Thanks again for everything you do!

@jb-alvarado
Copy link
Member

Have you restart the service? And what says: systemctl status ffplayout_engine? And the logs?

@tvadi
Copy link
Author

tvadi commented Jan 16, 2022

Ok, after a reboot and building of new playlist it is playing. I also put it back to your recommended settings:
ffmpeg_param: >- -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset medium -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k stream_output: >- -flags +global_header -f flv rtmp://localhost/live/stream -pix_fmt uyvy422 -vcodec v210 -f decklink "DeckLink SDI 4K"

Stop, restart and update service seem to not really work, the player just keeps showing progress of the file playing. Logging also seems to not always work, at least in the UI. I have to delete the current playlist to get it to stop, going to delete logs, reboot and see if that will give me an accurate/ current log..

@tvadi
Copy link
Author

tvadi commented Jan 16, 2022

All logs are from 2 days ago. Does not seem to be writing new ones.

@jb-alvarado
Copy link
Member

Have you check systemctl status ffplayout_engine?

@tvadi
Copy link
Author

tvadi commented Jan 16, 2022

Sorry, where is that?

@tvadi
Copy link
Author

tvadi commented Jan 16, 2022

Also, with the version of ffmpeg I am using, (that does play out the decklink and play in ffplayout stream to VLC) I was unable to compile with libzimg and libdav1d. Would those libraries missing cause any issues? I was able to mirror everything else the same as the ffmpeg that the installer makes.

@jb-alvarado
Copy link
Member

jb-alvarado commented Jan 17, 2022

Sorry, where is that?

You type this in terminal.

libzimg and libdav1d are optional.

@tvadi
Copy link
Author

tvadi commented Jan 17, 2022

Ok, thanks good to know. I am starting again with a fresh OS and fresh install of FFplayout. Just changed congfig with 1280x720 59.94fps and added .TS extension. Trying your recommended:
ffmpeg_param: >- -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset medium -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k stream_output: >- -flags +global_header -f flv rtmp://localhost/live/stream -pix_fmt uyvy422 -vcodec v210 -f decklink "DeckLink SDI 4K"

`[2022-01-17 02:51:23,849] [INFO] Play: /opt/tv-media/720ts_6DK01H_tru720og.ts
[2022-01-17 02:51:23,850] [DEBUG] Decoder CMD: "ffmpeg -v level+error -hide_banner -nostats -ss 21.726 -i /opt/tv-media/720ts_6DK01H_tru720og.ts -filter_complex [0:v]fps=25,scale=1024:576,tpad=stop_mode=add:stop_duration=0.8483936670000105,fade=in:st=0:d=0.5[v];[v]null[vout1] -filter_complex [0:a]anull,apad=whole_dur=170.83057166700002,afade=in:st=0:d=0.5[aout1] -map [vout1] -map [aout1] -pix_fmt yuv420p -r 25 -c:v mpeg2video -g 1 -b:v 58982.4k -minrate 58982.4k -maxrate 58982.4k -bufsize 29491.2k -c:a s302m -strict -2 -ar 48000 -ac 2 -f mpegts -"
[2022-01-17 02:54:14,104] [DEBUG] delta: 0.515103
[2022-01-17 02:54:14,104] [DEBUG] total_delta: 11110.895581

And from terminal:
`ffplayout_engine.service - python and ffmpeg based playout
Loaded: loaded (/etc/systemd/system/ffplayout_engine.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2022-01-17 02:44:25 CST; 15min ago
Main PID: 742 (python)
Tasks: 41 (limit: 9324)
Memory: 281.7M
CGroup: /system.slice/ffplayout_engine.service
├─ 742 /opt/ffplayout_engine/venv/bin/python /opt/ffplayout_engine/ffplayout.py
├─ 816 ffmpeg -v level+error -hide_banner -nostats -re -thread_queue_size 160 -i pipe:0 -metadata service_name=Live Stream -metadata service_provider=example.org -metadata year=2022 -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset medium -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +global_header -f flv rtmp://localhost/live/stream
└─3581 ffmpeg -v level+error -hide_banner -nostats -i /opt/tv-media/720ts_6DK01H_tru720og.ts -filter_complex [0:v]fps=25,scale=1024:576,tpad=stop_mode=add:stop_duration=0.8483936670000105[v];[v]null[vout1] -filter_complex [0:a]anull,apad=whole_dur=192.55657166700001[aout1] -pix_fmt yuv420p -r 25 -c:v mpeg2video -g 1 -b:v 58982.4k -minrate 58982.4k -maxrate 58982.4k -bufsize 29491.2k -c:a s302m -strict -2 -ar 48000 -ac 2 -f mpegts -

File playing MediInfo:
`Format : MPEG-TS
File size : 199 MiB
Duration : 3 min 12 s
Overall bit rate mode : Variable
Overall bit rate : 8 665 kb/s

Video
ID : 4096 (0x1000)
Menu ID : 1 (0x1)
Format : MPEG Video
Format version : Version 2
Format profile : 4:2:2@High
Format settings : CustomMatrix / BVOP
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : M=3, N=15
Codec ID : 2
Duration : 3 min 11 s
Bit rate mode : Constant
Bit rate : 7 849 kb/s
Maximum bit rate : 8 000 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate : 59.940 (60000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.142
Time code of first frame : 00:00:10;00
Time code source : Group of pictures header
GOP, Open/Closed : Closed
Stream size : 179 MiB (90%)

Audio
ID : 4097 (0x1001)
Menu ID : 1 (0x1)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Codec ID : 3
Duration : 3 min 11 s
Bit rate mode : Constant
Bit rate : 384 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 41.667 FPS (1152 SPF)
Compression mode : Lossy
Stream size : 8.78 MiB (4%)
Language : English

Text #1
ID : 4096 (0x1000)-CC1
Menu ID : 1 (0x1)
Format : EIA-608
Muxing mode : A/53 / DTVCC Transport
Muxing mode, more info : Muxed in Video #1
Duration : 3 min 11 s
Bit rate mode : Constant
Stream size : 0.00 Byte (0%)
CaptionServiceName : CC1

Text #2
ID : 4096 (0x1000)-1
Menu ID : 1 (0x1)
Format : EIA-708
Muxing mode : A/53 / DTVCC Transport
Muxing mode, more info : Muxed in Video #1
Duration : 3 min 11 s
Bit rate mode : Constant
Stream size : 0.00 Byte (0%)`

I can make any type of file if you want me to try something else or try any playout code changes..

@jb-alvarado
Copy link
Member

Have you also replace the engine again? The installer still uses the old version, which are not working correctly with your output settings.

But I don't see any errors there.

@tvadi
Copy link
Author

tvadi commented Jan 17, 2022

I can try and replace the engine now.

@jb-alvarado
Copy link
Member

Please add code blocks with 3 `, it makes it more readable.

Your systemd output shows also the old settings, no resolution change and not decklink output.

@tvadi
Copy link
Author

tvadi commented Jan 17, 2022

Sorry I will work on my code blocks, thought they were formatting. Seems the installers engine did not keep the output settings but the replaced engine is, getting errors now:
Playout log:

[2022-01-17 03:32:42,495] [DEBUG]  -------------------------------------------------------------------------------
[2022-01-17 03:32:43,901] [DEBUG]  Encoder CMD: "ffmpeg -v level+error -hide_banner -nostats -re -thread_queue_size 160 -i pipe:0 -metadata service_name=Live Stream -metadata service_provider=example.org -metadata year=2022 -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset medium -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +global_header -f flv rtmp://localhost/live/stream  -pix_fmt uyvy422 -vcodec v210 -f decklink "DeckLink SDI 4K""
[2022-01-17 03:32:43,903] [ERROR]  Playlist not exists: /opt/playlists/2022/01/2022-01-16.json
[2022-01-17 03:32:43,903] [ERROR]  Clip nodes are empty!
[2022-01-17 03:32:43,904] [DEBUG]  delta: -0.000014
[2022-01-17 03:32:43,904] [DEBUG]  total_delta: 8801.095942
[2022-01-17 03:32:43,904] [WARNING]  No filler clipt is set! Add dummy...
[2022-01-17 03:32:43,904] [INFO]  Play: color=c=#121212:s=1280x720:d=59.999:r=59.94,format=pix_fmts=yuv420p
[2022-01-17 03:32:43,904] [DEBUG]  Decoder CMD: "ffmpeg -v level+error -hide_banner -nostats -f lavfi -i color=c=#121212:s=1280x720:d=59.999:r=59.94,format=pix_fmts=yuv420p -f lavfi -i anoisesrc=d=59.999:c=pink:r=48000:a=0.05 -filter_complex [0:v]null[v];[v]null[vout1] -map [vout1] -map 1:a -pix_fmt yuv420p -r 59.94 -c:v mpeg2video -g 1 -b:v 92160.0k -minrate 92160.0k -maxrate 92160.0k -bufsize 46080.0k -c:a s302m -strict -2 -ar 48000 -ac 2 -f mpegts -"
[2022-01-17 03:32:44,010] [ERROR]  Broken Pipe!
[2022-01-17 03:32:44,011] [DEBUG]  -------------------------------------------------------------------------------
[2022-01-17 03:32:44,011] [DEBUG]  error: "[Errno 32] Broken pipe"
[2022-01-17 03:32:44,011] [DEBUG]  delta: "-1.4000004739500582e-05"
[2022-01-17 03:32:44,011] [DEBUG]  node: "{'begin': 99163.904044, 'number': 0, 'in': 0, 'seek': 0, 'out': 59.999, 'duration': 60, 'probe': , 'source': 'color=c=#121212:s=1280x720:d=59.999:r=59.94,format=pix_fmts=yuv420p', 'src_cmd': ['-f', 'lavfi', '-i', 'color=c=#121212:s=1280x720:d=59.999:r=59.94,format=pix_fmts=yuv420p', '-f', 'lavfi', '-i', 'anoisesrc=d=59.999:c=pink:r=48000:a=0.05'], 'filter': ['-filter_complex', '[0:v]null[v];[v]null[vout1]', '-map', '[vout1]', '-map', '1:a']}"
[2022-01-17 03:32:44,011] [DEBUG]  dec_cmd: "['ffmpeg', '-v', 'level+error', '-hide_banner', '-nostats', '-f', 'lavfi', '-i', 'color=c=#121212:s=1280x720:d=59.999:r=59.94,format=pix_fmts=yuv420p', '-f', 'lavfi', '-i', 'anoisesrc=d=59.999:c=pink:r=48000:a=0.05', '-filter_complex', '[0:v]null[v];[v]null[vout1]', '-map', '[vout1]', '-map', '1:a', '-pix_fmt', 'yuv420p', '-r', '59.94', '-c:v', 'mpeg2video', '-g', '1', '-b:v', '92160.0k', '-minrate', '92160.0k', '-maxrate', '92160.0k', '-bufsize', '46080.0k', '-c:a', 's302m', '-strict', '-2', '-ar', '48000', '-ac', '2', '-f', 'mpegts', '-']"
[2022-01-17 03:32:44,011] [DEBUG]  -------------------------------------------------------------------------------

Terminal:

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 Mon 2022-01-17 03:56:46 CST; 6min ago
    Process: 1520 ExecStart=/opt/ffplayout_engine/venv/bin/python /opt/ffplayout_engine/ffplayout.py (code=exited, status=203/EXEC)
   Main PID: 1520 (code=exited, status=203/EXEC)
Jan 17 03:56:46 tvadi0001 systemd[1]: ffplayout_engine.service: Scheduled restart job, restart counter is at 5.
Jan 17 03:56:46 tvadi0001 systemd[1]: Stopped python and ffmpeg based playout.
Jan 17 03:56:46 tvadi0001 systemd[1]: ffplayout_engine.service: Start request repeated too quickly.
Jan 17 03:56:46 tvadi0001 systemd[1]: ffplayout_engine.service: Failed with result 'exit-code'.
Jan 17 03:56:46 tvadi0001 systemd[1]: Failed to start python and ffmpeg based playout.

Not getting the most current log reading in the UI, seems to stop after failing with decklink..

@jb-alvarado
Copy link
Member

Ok. Can you post the output from running:

/opt/ffplayout_engine/venv/bin/python /opt/ffplayout_engine/ffplayout.py -l none

@tvadi
Copy link
Author

tvadi commented Jan 17, 2022

After replacing the engine, I also needed to:
create virtual environment: sudo virtualenv -p python3 venv run source ./venv/bin/activate sudo apt install python3-testresources install dependencies: sudo pip3 install -r requirements.txt

Here is that terminal run:
/opt/ffplayout_engine/venv/bin/python /opt/ffplayout_engine/ffplayout.py -l none Traceback (most recent call last): File "/opt/ffplayout_engine/ffplayout.py", line 28, in <module> from ffplayout.utils import playout, stdin_args, validate_ffmpeg_libs File "/opt/ffplayout_engine/ffplayout/utils.py", line 45, in <module> import yaml ModuleNotFoundError: No module named 'yaml'

I did:
pip install pyyaml
got
Requirement already satisfied: pyyaml in /usr/local/lib/python3.8/dist-packages (5.4.1)

Also tried to check the version..
python -c 'import yaml, sys; print(yaml.safe_load(sys.stdin))' < data.yaml bash: data.yaml: No such file or directory

@jb-alvarado
Copy link
Member

Yes that is true you need to install a virtual environment. But I think doing this things with sudo is not working correctly.

Better login in root and source the environment and then install the requirements.

@tvadi
Copy link
Author

tvadi commented Jan 18, 2022

Logged in as root and it is working and playing out the Decklink! This is awesome :] So logged in as root I did:

virtualenv -p python3 venv source ./venv/bin/activate apt install python3-testresources pip3 install -r requirements.txt

And all is well on normal user as well :]

@tvadi tvadi closed this as completed Jan 18, 2022
@tvadi tvadi reopened this Jan 23, 2022
@tvadi
Copy link
Author

tvadi commented Jan 23, 2022

So I have this working for Ubuntu 20.04 but it is not working for 21.10 as I need that version to get MPV player to work. So I did everything the same, logged in as root, ran the installer, replaced the engine from master git, updated smtp server and port in ffplayout.yml, create virtual environment:

sudo virtualenv -p python3 venv 
source ./venv/bin/activate
sudo apt install python3-testresources
sudo pip3 install -r requirements.txt

Getting nothing in the logs and:

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 Sat 2022-01-22 23:21:00 CST; 1min 8s ago
    Process: 12189 ExecStart=/opt/ffplayout_engine/venv/bin/python /opt/ffplayout_engine/ffplayout.py (code=exited, status=1/FAILURE)
   Main PID: 12189 (code=exited, status=1/FAILURE)
        CPU: 91ms
systemd[1]: ffplayout_engine.service: Scheduled restart job, restart counter is at 5.
 systemd[1]: Stopped python and ffmpeg based playout.
systemd[1]: ffplayout_engine.service: Start request repeated too quickly.
systemd[1]: ffplayout_engine.service: Failed with result 'exit-code'.
systemd[1]: Failed to start python and ffmpeg based playout.

Any advice would be great, thanks!

@jb-alvarado
Copy link
Member

jb-alvarado commented Jan 23, 2022

I think you will see what is happen, when you run again:

/opt/ffplayout_engine/venv/bin/python /opt/ffplayout_engine/ffplayout.py -l none

Here you also make the same mistake:

sudo virtualenv -p python3 venv
source ./venv/bin/activate  # <--- wrong
sudo apt install python3-testresources
sudo pip3 install -r requirements.txt

You ran everything as root, but you source the environment as normal user. This can not work ;-).

@tvadi
Copy link
Author

tvadi commented Jan 23, 2022

Ok opp, I was going off my notes, I will update those, thanks for catching that! To clarify, should I be doing the install, engine replacement and virtualenv while logged in as root or just virtualenv?

When I run
/opt/ffplayout_engine/venv/bin/python /opt/ffplayout_engine/ffplayout.py -l none
I get:
Traceback (most recent call last): File "/opt/ffplayout_engine/ffplayout.py", line 28, in <module> from ffplayout.utils import playout, stdin_args, validate_ffmpeg_libs File "/opt/ffplayout_engine/ffplayout/utils.py", line 45, in <module> import yaml ModuleNotFoundError: No module named 'yaml'
Pretty sure I have yaml..
pip install pyyaml Requirement already satisfied: pyyaml in /usr/local/lib/python3.9/dist-packages (5.4.1)
Maybe this is due to my error with sudo, I will try again fresh, as always thanks for your help!

@jb-alvarado
Copy link
Member

I'm working on a new major version, which has braking changes. So better save the engine folder, because it will take time until the release will come and I can not guarantee that the master will work with the current API and frontend.

@tvadi
Copy link
Author

tvadi commented Jan 24, 2022

Ok, saved all repos currently up. Saves the disk with Ubuntu 20.04 and playout with decklink working (not sure if I have the repos though). Working on this new disk for Ubuntu 21.10 as I will need to be on that OS version but still having problems getting it to work. Here is what I am doing-
FFmpeg installed and good with the same libraries as used in the version of FFmpeg used in the FFplayout installer.
Log in as root
apt install -y curl
git clone https://github.com/ffplayout/ffplayout-installer.git
cd ffplayout-installer
./install.sh
`domain: 192.168.1.xxx (machine domain)

https? No

compile and install srs rtmp/hls server? yes

media path- /opt/tv-media

playlist path- /opt/playlists

ffmpeg: -will not ask since it is installed

multi channel setup (Y/n) : no

Do you wish to install nginx? (Y/n) : y`

Installer finishes but shows:

`HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v3.1.0.tar.gz’

v3.1.0.tar.gz [ <=> ] 1.16M 6.53MB/s in 0.2s

2022-01-24 10:19:47 (6.53 MB/s) - ‘v3.1.0.tar.gz’ saved [1212498]

bash: line 1: npm: command not found
bash: line 1: npm: command not found


installation done...`

While still logged in as root, download the ffplayout_engine zip from master branch and override /opt/ffplayout_engine
cp -R /root/ffplayout_engine /opt

gedit /etc/ffplayout/ffplayout.yml
smpt_server -> smtp_server
smpt_port -> smtp_port

cd /opt/ffplayout_engine
virtualenv -p python3 venv
source ./venv/bin/activate
apt install python3-testresources
pip3 install -r requirements.txt

Go to http://192.168.1.xxx/ < machine IP, get:

404 Not Found nginx/1.18.0 (Ubuntu)

@jb-alvarado
Copy link
Member

Not everything was installed. Maybe there was temporary something offline. I have to check this tomorrow.

@tvadi
Copy link
Author

tvadi commented Jan 24, 2022

Ok, thanks. Would like to find a way to install off line, just to avoid issues if things change, I will research that.

@jb-alvarado
Copy link
Member

I was not able to reproduce. Everything run normal.

@tvadi
Copy link
Author

tvadi commented Jan 26, 2022

On Ubuntu 21.10? Definitely not working on 21 like it is on 20. Maybe I should use CentOS? So installed, web UI comes but would not show files playing on player from playlist. Replaced the engine, same not playing, logged in as root, did the python3 venv/ activate/ install -r requirements..
Trying to edit anything in the web config I get:
Error: Request failed with status code 500
That's new..

Checking system gives:
ffplayout_engine.service - python and ffmpeg based playout Loaded: loaded (/etc/systemd/system/ffplayout_engine.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2022-01-25 22:37:00 CST; 30s ago Main PID: 16368 (python) Tasks: 41 (limit: 9339) Memory: 333.1M CPU: 1min 13.448s CGroup: /system.slice/ffplayout_engine.service ├─16368 /opt/ffplayout_engine/venv/bin/python /opt/ffplayout_engine/ffplayout.py ├─16370 ffmpeg -v level+error -hide_banner -nostats -re -thread_queue_size 160 -i pipe:0 -metadata service_name=Live Stream -metadata service__provider=example.org -metadata year=2022 -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset medium -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +global_header -f flv rtmp://localhost/live/stream └─16927 ffmpeg -v level+error -hide_banner -nostats -i /opt/tv-media/720ts_.ts -filter_complex [0:v]fps=59.94,tpad=stop_mode=add:stop_duration=0.8483936670000105[v];[v]null[vout1] -filter_complex [0:a]anull,apad=whole_dur=192.55657166700001[aout1] -map [vout1] -map [aout1] -pix_fmt yuv420p -r 59.94 -c:v mpeg2video -g 1 -b:v 92160.0k -minrate 92160.0k -maxrate 92160.0k -bufsize 46080.0k -c:a s302m -strict -2 -ar 48000 -ac 2 -f mpegts -

Jan 25 22:37:00 tvadi0001 systemd[1]: Started python and ffmpeg based playout.

@tvadi
Copy link
Author

tvadi commented Jan 26, 2022

Ok, just ran the installer on a fresh Ubuntu 21.10 and everything works as it should except for Decklink (needs ffmpeg compile with Decklink support). When I compile ffmpeg with Decklink support, it plays out the card as it should but one thing that is different in compiling on Ubuntu 21 vs 20 is that on 21 it cannot find libzmq 4.2.1 even when I have
sudo apt-get install libzmq3-dev
The only way I could get libzmq to work was to use gcc 9, get zeromq-4.2.1.tar.gz from https://github.com/zeromq/libzmq/releases
./autogen.sh ./configure make sudo make install

Pretty sure I needed libzmq in ffmpeg for ffplayout to run right? It was failing before when I did not have it, pretty sure..

@jb-alvarado
Copy link
Member

For the installer I uses this script, this compiles libzmq. You can extend it to your needs.

@tvadi
Copy link
Author

tvadi commented Jan 26, 2022

Ok, ditched libzmq in my ffmpeg compile and ffplayout is working like a champ again, playing out Decklink on Ubuntu 21.10. I had seen some issues with libzmq, seems even if you do libzmq3-dev, ffmpeg 4.4 still wants libzmq 4.2.1 for some reason even though that's like 6 years old and seems to have got lost at some point. I don't currently need text overlay so just going to skip it, I will ask on zeromq git and ffmpeg if there is a solution, seems like a bug.

For FFplayout to work with Decklink, I did have to replace the engine and log in as root to do the python3 venv/ activate/ install -r requirements.

Still looking for a way to do offline install/ set up.. just do be able to have a solid base for trouble shooting and if the internet blows up and I don't have a connection or libs change, maybe I'm just old school.. Is there a list anywhere of all the dependencies/ libs/ packages needed for FFplayout? Guessing I could look at the install log and try and figure out whats going on. Would I be able to use something like Synaptic or Keryx. Maybe the best approach at that point would be to not use the installer and work with the engine, api and front end individually.. ? Just kind of thinking out loud, I'm not really a programmer, but open to learning. :] Thanks again for always stepping up on the assist, cheers!

@jb-alvarado
Copy link
Member

Every repo has his docs folder and inside this is a short install instruction. I guess, when you observe them you get an idea what's needed.

@jb-alvarado
Copy link
Member

I close here, because the original issue is fixed.

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