remove ffpapi references

This commit is contained in:
jb-alvarado 2024-06-12 10:16:00 +02:00
parent 4dc6feab30
commit 26ec945921
18 changed files with 45 additions and 89 deletions

1
.gitignore vendored
View File

@ -20,7 +20,6 @@
*.deb
*.rpm
ffplayout.1.gz
ffpapi.1.gz
/assets/*.db*
/dist/
/public/

View File

@ -59,10 +59,6 @@ For preview stream, read: [/docs/preview_stream.md](/docs/preview_stream.md)
**\* Experimental features do not guarantee the same stability and may fail under unusual circumstances. Code and configuration options may change in the future.**
## **ffplayout-api (ffpapi)**
ffpapi serves the [frontend](https://github.com/ffplayout/ffplayout-frontend) and it acts as a [REST API](/ffplayout-api/README.md) for controlling the engine, manipulate playlists, add settings etc.
### Requirements
- RAM and CPU depends on video resolution, minimum 4 threads and 3GB RAM for 720p are recommend

2
debian/postinst vendored
View File

@ -19,7 +19,7 @@ if [ ! -d "/usr/share/ffplayout/db" ]; then
IP=$(hostname -I | cut -d ' ' -f1)
/usr/bin/ffpapi -i -d "${IP}:8787"
/usr/bin/ffplayout -i -d "${IP}:8787"
chown -R ${sysUser}: "/usr/share/ffplayout"
chown -R ${sysUser}: "/var/lib/ffplayout"

View File

@ -29,12 +29,9 @@ RUN dnf update -y && \
RUN [[ -f /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm ]] || wget -q "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm" -P /tmp/ && \
dnf install -y /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
sed -i "s/User=ffpu/User=root/g" /usr/lib/systemd/system/ffpapi.service && \
sed -i "s/User=ffpu/User=root/g" /usr/lib/systemd/system/ffplayout.service && \
sed -i "s/User=ffpu/User=root/g" /usr/lib/systemd/system/ffplayout@.service && \
systemctl enable ffplayout && \
systemctl enable ffpapi && \
ffpapi -u admin -p admin -m contact@example.com
ffplayout -u admin -p admin -m contact@example.com
EXPOSE 8787

View File

@ -26,7 +26,7 @@ You can take a look at the [Dockerfile](Dockerfile)
## Storage
There are some folders/files that are important for ffplayout to work well such as:
- **/usr/share/ffplayout/db** => where all the data for the `ffpapi` are stored (user/pass etc)
- **/usr/share/ffplayout/db** => where all the data are stored (user/pass etc)
- **/var/lib/ffplayout/tv-media** => where the media are stored by default (configurable)
- **/var/lib/ffplayout/playlists** => where playlists are stored (configurable)
- **/etc/ffplayout/ffplayout.yml** => the core config file

View File

@ -139,7 +139,6 @@ ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
COPY --from=build /usr/local/ /usr/local/
ADD ./overide.conf /etc/systemd/system/ffplayout.service.d/overide.conf
ADD ./overide.conf /etc/systemd/system/ffpapi.service.d/overide.conf
RUN \
dnf update -y \
@ -155,8 +154,7 @@ RUN \
rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu && \
systemctl enable ffplayout && \
systemctl enable ffpapi && \
ffpapi -u admin -p admin -m contact@example.com
ffplayout -u admin -p admin -m contact@example.com
EXPOSE 8787

View File

@ -102,8 +102,7 @@ RUN yum update -y \
&& echo 'Docker!' | passwd --stdin root \
&& rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm \
&& mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu \
&& systemctl enable ffplayout \
&& systemctl enable ffpapi
&& systemctl enable ffplayout
EXPOSE 8787
RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/nvidia.conf

View File

@ -1,6 +1,6 @@
## Advanced settings
Within **/etc/ffplayout/advanced.yml** you can control all ffmpeg inputs/decoder output and filters.
With **advanced settings** you can control all ffmpeg inputs/decoder output and filters.
> **_Note:_** Changing these settings is for advanced users only! There will be no support or guarantee that it will work and be stable after changing them!

View File

@ -1,9 +1,9 @@
## Possible endpoints
### Possible endpoints
Run the API thru the systemd service, or like:
```BASH
ffpapi -l 127.0.0.1:8787
ffplayout -l 127.0.0.1:8787
```
For all endpoints an (Bearer) authentication is required.\
@ -72,7 +72,7 @@ curl -X GET 'http://127.0.0.1:8787/api/user/2' -H 'Content-Type: application/jso
-H 'Authorization: Bearer <TOKEN>'
```
#### ffpapi Settings
#### Settings
**Get Settings from Channel**
@ -87,9 +87,7 @@ curl -X GET http://127.0.0.1:8787/api/channel/1 -H "Authorization: Bearer <TOKEN
"id": 1,
"name": "Channel 1",
"preview_url": "http://localhost/live/preview.m3u8",
"config_path": "/etc/ffplayout/ffplayout.yml",
"extra_extensions": "jpg,jpeg,png",
"service": "ffplayout.service",
"utc_offset": "+120"
}
```
@ -104,7 +102,7 @@ curl -X GET http://127.0.0.1:8787/api/channels -H "Authorization: Bearer <TOKEN>
```BASH
curl -X PATCH http://127.0.0.1:8787/api/channel/1 -H "Content-Type: application/json" \
-d '{ "id": 1, "name": "Channel 1", "preview_url": "http://localhost/live/stream.m3u8", "config_path": "/etc/ffplayout/ffplayout.yml", "extra_extensions": "jpg,jpeg,png"}' \
-d '{ "id": 1, "name": "Channel 1", "preview_url": "http://localhost/live/stream.m3u8", "extra_extensions": "jpg,jpeg,png"}' \
-H "Authorization: Bearer <TOKEN>"
```
@ -112,7 +110,7 @@ curl -X PATCH http://127.0.0.1:8787/api/channel/1 -H "Content-Type: application/
```BASH
curl -X POST http://127.0.0.1:8787/api/channel/ -H "Content-Type: application/json" \
-d '{ "name": "Channel 2", "preview_url": "http://localhost/live/channel2.m3u8", "config_path": "/etc/ffplayout/channel2.yml", "extra_extensions": "jpg,jpeg,png", "service": "ffplayout@channel2.service" }' \
-d '{ "name": "Channel 2", "preview_url": "http://localhost/live/channel2.m3u8", "extra_extensions": "jpg,jpeg,png" }' \
-H "Authorization: Bearer <TOKEN>"
```
@ -130,7 +128,7 @@ curl -X DELETE http://127.0.0.1:8787/api/channel/2 -H "Authorization: Bearer <TO
curl -X GET http://127.0.0.1:8787/api/playout/config/1 -H 'Authorization: Bearer <TOKEN>'
```
Response is a JSON object from the ffplayout.yml
Response is a JSON object from the ffplayout.toml
**Update Config**
@ -210,38 +208,19 @@ curl -X GET http://127.0.0.1:8787/api/control/1/media/current
**Response:**
```JSON
{
"jsonrpc": "2.0",
"result": {
"current_media": {
{
"media": {
"category": "",
"duration": 154.2,
"out": 154.2,
"seek": 0.0,
"in": 0.0,
"source": "/opt/tv-media/clip.mp4"
},
"index": 39,
"play_mode": "playlist",
"played_sec": 67.80771999300123,
"remaining_sec": 86.39228000699876,
"start_sec": 24713.631999999998,
"start_time": "06:51:53.631"
},
"id": 1
}
```
**Get next Clip**
```BASH
curl -X GET http://127.0.0.1:8787/api/control/1/media/next -H 'Authorization: Bearer <TOKEN>'
```
**Get last Clip**
```BASH
curl -X GET http://127.0.0.1:8787/api/control/1/media/last
-H 'Content-Type: application/json' -H 'Authorization: Bearer <TOKEN>'
"ingest": false,
"mode": "playlist",
"played": 67.808
}
```
#### ffplayout Process Control

View File

@ -7,32 +7,26 @@ ffplayout provides ***.deb** and ***.rpm** packages, which makes it more easy to
3. install ffmpeg/ffprobe, or compile and copy it to **/usr/local/bin/**
4. activate systemd services:
- `systemctl enable ffplayout`
- `systemctl enable --now ffpapi`
5. add admin user to ffpapi:
- `ffpapi -a`
5. add admin:
- `ffplayout -a`
6. use a revers proxy for SSL, Port is **8787**.
7. login with your browser, address without proxy would be: **http://[IP ADDRESS]:8787**
Default location for playlists and media files are: **/var/lib/ffplayout/**.
When you don't need the frontend and API, skip enable the systemd service **ffpapi**.
When playlists are created and the ffplayout output is configured, you can start the process: `systemctl start ffplayout`, or click start in frontend.
If you want to configure ffplayout over terminal, you can edit **/etc/ffplayout/ffplayout.yml**.
### Manual Install
-----
- install ffmpeg/ffprobe, or compile and copy it to **/usr/local/bin/**
- download the latest archive from [release](https://github.com/ffplayout/ffplayout/releases/latest) page
- copy the ffplayout and ffpapi binary to `/usr/bin/`
- copy the ffplayout binary to `/usr/bin/`
- copy **assets/ffplayout.yml** to `/etc/ffplayout`
- create folder `/var/log/ffplayout`
- create system user **ffpu**
- give ownership from `/etc/ffplayout` and `/var/log/ffplayout` to **ffpu**
- copy **assets/ffpapi.service**, **assets/ffplayout.service** and **assets/ffplayout@.service** to `/etc/systemd/system`
- copy **assets/11-ffplayout** to `/etc/sudoers.d/`
- copy **assets/ffpapi.1.gz** and **assets/ffplayout.1.gz** to `/usr/share/man/man1/`
- copy **assets/ffplayout.service** to `/etc/systemd/system`
- copy **assets/ffplayout.1.gz** to `/usr/share/man/man1/`
- copy **public** folder to `/usr/share/ffplayout/`
- activate service and run it: `systemctl enable --now ffpapi ffplayout`
- activate service and run it: `systemctl enable --now ffplayout`

View File

@ -72,7 +72,7 @@ In this mode you can output directly to a hls playlist. The nice thing here is,
HLS output is currently the default, mostly because it works out of the box and don't need a streaming target. In default settings it saves the segments to **/usr/share/ffplayout/public/live/**.
**It is recommend to serve the HLS stream with nginx or another web server, and not with ffpapi (which is more meant for previewing).**
**It is recommend to serve the HLS stream with nginx or another web server, and not with ffplayout (which is more meant for previewing).**
**HLS multiple outputs example:**

View File

@ -2,10 +2,10 @@ use static_files::NpmBuild;
fn main() -> std::io::Result<()> {
if !cfg!(debug_assertions) && cfg!(feature = "embed_frontend") {
NpmBuild::new("../ffplayout-frontend")
NpmBuild::new("../frontend")
.install()?
.run("generate")?
.target("../ffplayout-frontend/.output/public")
.target("../frontend/.output/public")
.change_detection()
.to_resource_dir()
.build()

View File

@ -3,7 +3,7 @@
/// Run the API thru the systemd service, or like:
///
/// ```BASH
/// ffpapi -l 127.0.0.1:8787
/// ffplayout -l 127.0.0.1:8787
/// ```
///
/// For all endpoints an (Bearer) authentication is required.\
@ -377,7 +377,7 @@ async fn remove_user(
}
}
/// #### ffpapi Settings
/// #### Settings
///
/// **Get Settings from Channel**
///
@ -392,9 +392,7 @@ async fn remove_user(
/// "id": 1,
/// "name": "Channel 1",
/// "preview_url": "http://localhost/live/preview.m3u8",
/// "config_path": "/etc/ffplayout/ffplayout.toml",
/// "extra_extensions": "jpg,jpeg,png",
/// "service": "ffplayout.service",
/// "utc_offset": "+120"
/// }
/// ```
@ -430,7 +428,7 @@ async fn get_all_channels(pool: web::Data<Pool<Sqlite>>) -> Result<impl Responde
///
/// ```BASH
/// curl -X PATCH http://127.0.0.1:8787/api/channel/1 -H "Content-Type: application/json" \
/// -d '{ "id": 1, "name": "Channel 1", "preview_url": "http://localhost/live/stream.m3u8", "config_path": "/etc/ffplayout/ffplayout.toml", "extra_extensions": "jpg,jpeg,png"}' \
/// -d '{ "id": 1, "name": "Channel 1", "preview_url": "http://localhost/live/stream.m3u8", "extra_extensions": "jpg,jpeg,png"}' \
/// -H "Authorization: Bearer <TOKEN>"
/// ```
#[patch("/channel/{id}")]
@ -454,7 +452,7 @@ async fn patch_channel(
///
/// ```BASH
/// curl -X POST http://127.0.0.1:8787/api/channel/ -H "Content-Type: application/json" \
/// -d '{ "name": "Channel 2", "preview_url": "http://localhost/live/channel2.m3u8", "config_path": "/etc/ffplayout/channel2.toml", "extra_extensions": "jpg,jpeg,png", "service": "ffplayout@channel2.service" }' \
/// -d '{ "name": "Channel 2", "preview_url": "http://localhost/live/channel2.m3u8", "extra_extensions": "jpg,jpeg,png" }' \
/// -H "Authorization: Bearer <TOKEN>"
/// ```
#[post("/channel/")]

View File

@ -230,7 +230,7 @@ async fn main() -> std::io::Result<()> {
.run()
.await
} else {
error!("Run ffpapi with listen parameter!");
error!("Run ffplayout with listen parameter!");
Ok(())
}

View File

@ -318,7 +318,7 @@ pub async fn run_args() -> Result<(), i32> {
let mut args = ARGS.clone();
if args.listen.is_none() && !args.ask && args.username.is_none() {
eprintln!("Wrong number of arguments! Run ffpapi --help for more information.");
eprintln!("Wrong number of arguments! Run ffplayout --help for more information.");
return Err(0);
}

View File

@ -120,7 +120,7 @@ CREATE TABLE
task_help TEXT NOT NULL DEFAULT "Run an external program with a given media object. The media object is in json format and contains all the information about the current clip. The external program can be a script or a binary, but should only run for a short time.",
task_enable INTEGER NOT NULL DEFAULT 0,
task_path TEXT NOT NULL DEFAULT "",
output_help TEXT NOT NULL DEFAULT "The final playout compression. Set the settings to your needs. 'mode' has the options 'desktop', 'hls', 'null', 'stream'. Use 'stream' and adjust 'output_param:' settings when you want to stream to a rtmp/rtsp/srt/... server.\nIn production don't serve hls playlist with ffpapi, use nginx or another web server!",
output_help TEXT NOT NULL DEFAULT "The final playout compression. Set the settings to your needs. 'mode' has the options 'desktop', 'hls', 'null', 'stream'. Use 'stream' and adjust 'output_param:' settings when you want to stream to a rtmp/rtsp/srt/... server.\nIn production don't serve hls playlist with ffplayout, use nginx or another web server!",
output_mode TEXT NOT NULL DEFAULT "hls",
output_param TEXT NOT NULL DEFAULT "-c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset faster -tune zerolatency -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +cgop -f hls -hls_time 6 -hls_list_size 600 -hls_flags append_list+delete_segments+omit_endlist -hls_segment_filename /usr/share/ffplayout/public/live/stream-%d.ts /usr/share/ffplayout/public/live/stream.m3u8",
FOREIGN KEY (channel_id) REFERENCES channels (id) ON UPDATE CASCADE ON DELETE CASCADE

View File

@ -3,7 +3,7 @@
source $(dirname "$0")/man_create.sh
target=$1
if [ ! -f 'ffplayout-frontend/package.json' ]; then
if [ ! -f 'frontend/package.json' ]; then
git submodule update --init
fi
@ -34,10 +34,9 @@ for target in "${targets[@]}"; do
cross build --release --target=$target
cp ./target/${target}/release/ffpapi.exe .
cp ./target/${target}/release/ffplayout.exe .
zip -r "ffplayout-v${version}_${target}.zip" assets docker docs LICENSE README.md CHANGELOG.md ffplayout.exe ffpapi.exe -x *.db -x *.db-shm -x *.db-wal -x '11-ffplayout' -x *.service
rm -f ffplayout.exe ffpapi.exe
zip -r "ffplayout-v${version}_${target}.zip" assets docker docs LICENSE README.md CHANGELOG.md ffplayout.exe -x *.db -x *.db-shm -x *.db-wal -x '11-ffplayout' -x *.service
rm -f ffplayout.exe
else
if [[ -f "ffplayout-v${version}_${target}.tar.gz" ]]; then
rm -f "ffplayout-v${version}_${target}.tar.gz"
@ -45,20 +44,19 @@ for target in "${targets[@]}"; do
cross build --release --target=$target
cp ./target/${target}/release/ffpapi .
cp ./target/${target}/release/ffplayout .
tar -czvf "ffplayout-v${version}_${target}.tar.gz" --exclude='*.db' --exclude='*.db-shm' --exclude='*.db-wal' assets docker docs LICENSE README.md CHANGELOG.md ffplayout ffpapi
rm -f ffplayout ffpapi
tar -czvf "ffplayout-v${version}_${target}.tar.gz" --exclude='*.db' --exclude='*.db-shm' --exclude='*.db-wal' assets docker docs LICENSE README.md CHANGELOG.md ffplayout
rm -f ffplayout
fi
echo ""
done
if [[ "${#targets[@]}" == "5" ]] || [[ $targets == "x86_64-unknown-linux-musl" ]]; then
cargo deb --no-build --target=x86_64-unknown-linux-musl -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml -o ffplayout_${version}-1_amd64.deb
cargo generate-rpm --payload-compress none --target=x86_64-unknown-linux-musl -p ffplayout-engine -o ffplayout-${version}-1.x86_64.rpm
cargo deb --no-build --target=x86_64-unknown-linux-musl -p ffplayout --manifest-path=ffplayout/Cargo.toml -o ffplayout_${version}-1_amd64.deb
cargo generate-rpm --payload-compress none --target=x86_64-unknown-linux-musl -p ffplayout -o ffplayout-${version}-1.x86_64.rpm
fi
if [[ "${#targets[@]}" == "5" ]] || [[ $targets == "aarch64-unknown-linux-gnu" ]]; then
cargo deb --no-build --target=aarch64-unknown-linux-gnu --variant=arm64 -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml -o ffplayout_${version}-1_arm64.deb
cargo deb --no-build --target=aarch64-unknown-linux-gnu --variant=arm64 -p ffplayout --manifest-path=ffplayout/Cargo.toml -o ffplayout_${version}-1_arm64.deb
fi

View File

@ -1,11 +1,11 @@
#!/usr/bin/bash
yes | rm -f assets/ffplayout.1.gz
yes | rm -f assets/ffpapi.1.gz
engine_docs=(
"README.md"
"ffplayout-engine/README.md"
"docs/api.md"
"ffplayout/README.md"
"docs/install.md"
"docs/output.md"
"docs/live_ingest.md"
@ -18,7 +18,5 @@ api_docs=(
)
pandoc "${engine_docs[@]}" -s --wrap=preserve -t man -o assets/ffplayout.1
pandoc "${api_docs[@]}" -s --wrap=preserve -t man -o assets/ffpapi.1
gzip assets/ffplayout.1
gzip assets/ffpapi.1