2023-02-07 22:00:04 +01:00
|
|
|
# ansible_playbook_audiometer
|
|
|
|
|
2023-02-17 15:50:19 +01:00
|
|
|
Ansible Playbook to Install Audio Meter
|
|
|
|
|
|
|
|
## Some useful links:
|
|
|
|
+ [FFMPEG HLS](https://www.martin-riedl.de/2018/08/24/using-ffmpeg-as-a-hls-streaming-server-part-1/)
|
|
|
|
|
2023-02-21 00:49:58 +01:00
|
|
|
```
|
|
|
|
ACHTUNG
|
|
|
|
|
|
|
|
Shitty ansible, sollte man in schön machen.
|
|
|
|
Soll jetzt aber laufen und ist dringend/keine Zeit und so... ;P
|
|
|
|
```
|
|
|
|
|
2023-02-17 15:50:19 +01:00
|
|
|
## FFMPEG COMMAND
|
|
|
|
Generate Audiometer for video
|
2024-10-28 14:23:34 +01:00
|
|
|
|
2023-02-17 15:50:19 +01:00
|
|
|
```bash
|
|
|
|
#!/bin/bash
|
|
|
|
# video in 640 x 960 and 25FPS
|
|
|
|
yt-dlp "https://youtu.be/eWZwzxNSLVc" -o - | ffmpeg -y -i pipe: \
|
|
|
|
-nostats \
|
2023-11-03 02:10:30 +01:00
|
|
|
-loglevel repeat+level+info \
|
|
|
|
-filter_complex \
|
|
|
|
"[0:v:0]scale=640x360[orig_scaled];\
|
|
|
|
[0:a:0]aformat=channel_layouts=stereo:sample_rates=44100:sample_fmts=fltp[0:a:0];\
|
|
|
|
[orig_scaled]drawtext=fontfile=$FONT:text=$STREAM:fontcolor=white:fontsize=100:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/1.5[preview_overlay];\
|
|
|
|
[0:a:0]ebur128=video=1:size=640x480:meter=9:target=-16:gauge=shortterm[native][native_a]; [native_a]anullsink; \
|
|
|
|
[native]drawtext=fontfile=$FONT:text=native:fontcolor=white:fontsize=60:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/1.5[native_overlay];\
|
|
|
|
[0:a:0]showvolume=r=50:w=640:h=60:b=0:ds=log:dm=1.0[native_vu]; \
|
|
|
|
[preview_overlay][native_vu][native_overlay]vstack=inputs=3[full_mix]" \
|
|
|
|
-map "[full_mix]" -map 0:a:0 \
|
|
|
|
-g 30 \
|
|
|
|
-c:v libx264 -bufsize 16M -maxrate 8M -crf 24 -pix_fmt yuv420p -preset ultrafast \
|
|
|
|
-c:a aac -strict -2 -b:a 192k \
|
|
|
|
-f mpegts "udp://[ffd2::1]:1235"
|
2023-02-17 15:50:19 +01:00
|
|
|
```
|
|
|
|
|
2024-10-28 14:23:34 +01:00
|
|
|
Listen to rtmp and gen hls
|
|
|
|
```bash
|
2023-02-17 15:50:19 +01:00
|
|
|
ffmpeg -listen 1 -i rtmp://localhost/stream \
|
|
|
|
-nostats \
|
|
|
|
-loglevel repeat+level+info \
|
|
|
|
-filter_complex \
|
|
|
|
"[0:v:0]scale=640x360[orig_scaled];\
|
|
|
|
[full_mix]framerate=fps=25[out]; \
|
|
|
|
[orig_scaled]drawtext=fontfile=$FONT:text=$STREAM:fontcolor=white:fontsize=100:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/1.5[preview_overlay];\
|
|
|
|
[0:a:0]ebur128=video=1:size=640x480:meter=9:target=-16:gauge=shortterm[native][native_a]; [native_a]anullsink; \
|
|
|
|
[native]drawtext=fontfile=$FONT:text=native:fontcolor=white:fontsize=60:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/1.5[native_overlay];\
|
|
|
|
[0:a:0]showvolume=r=50:w=640:h=60:b=0:ds=log:dm=1.0[native_vu]; \
|
|
|
|
[preview_overlay][native_vu][native_overlay]vstack=inputs=3[full_mix] " \
|
|
|
|
-map "[out]" \
|
|
|
|
-g 30 \
|
|
|
|
-c:v libx264 -bufsize 16M -maxrate 8M -crf 24 -pix_fmt yuv420p -preset ultrafast \
|
|
|
|
-f hls -hls_time 4 -hls_playlist_type event stream.m3u8
|
|
|
|
```
|
|
|
|
|
|
|
|
Stream to rtmp://localhost/stream
|
2024-10-28 14:23:34 +01:00
|
|
|
|
|
|
|
```bash
|
2023-02-17 15:50:19 +01:00
|
|
|
yt-dlp "https://youtu.be/eWZwzxNSLVc" -o - | ffmpeg -y -i pipe: \
|
|
|
|
-c:v libx264 -bufsize 16M -maxrate 8M -crf 24 -pix_fmt yuv420p -preset ultrafast \
|
|
|
|
-c:a aac \
|
|
|
|
-f flv rtmp://localhost/stream
|
|
|
|
```
|
|
|
|
|
2024-10-28 14:23:34 +01:00
|
|
|
Audio to audiometer
|
|
|
|
|
|
|
|
```bash
|
|
|
|
ffmpeg -i "https://st01.sslstream.dlf.de/dlf/01/high/aac/stream.aac" \
|
|
|
|
-filter_complex \
|
|
|
|
"color=c=black:size=640x480:rate=25[bg]; \
|
|
|
|
[0:a]ebur128=video=1:size=640x480:meter=9:target=-16[volume_meter]; \
|
|
|
|
[bg][volume_meter]overlay=format=yuv420[out]" \
|
|
|
|
-map "[out]" -map 0:a -c:v libx264 -c:a aac -b:a 128k \
|
|
|
|
-crf 24 -pix_fmt yuv420p -preset ultrafast \
|
|
|
|
-strict -2 -b:a 192k \
|
|
|
|
-f mpegts "udp://[ffd2::1]:1235"
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2023-02-17 15:50:19 +01:00
|
|
|
Webplayer example
|
|
|
|
```
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset=utf-8 />
|
|
|
|
<title>videojs-contrib-hls embed</title>
|
|
|
|
<link href="//vjs.zencdn.net/7.10.2/video-js.min.css" rel="stylesheet">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<video-js id=vid1 width=640 height=960 class="vjs-default-skin" controls>
|
|
|
|
<source
|
|
|
|
src="stream.m3u8"
|
|
|
|
type="application/x-mpegURL">
|
|
|
|
</video-js>
|
|
|
|
<script src="//vjs.zencdn.net/7.10.2/video.min.js"></script>
|
|
|
|
<script src="https://github.com/videojs/http-streaming/releases/download/v2.16.0/videojs-http-streaming.min.js"></script>
|
|
|
|
<script>
|
|
|
|
var player = videojs('vid1');
|
|
|
|
player.play();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
2024-10-28 14:23:34 +01:00
|
|
|
```
|