From c672750d10248b0e163cabe66ebbfa971105c7f0 Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Sun, 14 Apr 2019 19:43:50 +0200 Subject: [PATCH] Add example script by @uo0Evx99@mastodon.cloud --- .../resources/html/docs/PostProcessing.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/client/src/main/resources/html/docs/PostProcessing.md b/client/src/main/resources/html/docs/PostProcessing.md index 693d00ef..d20a1929 100644 --- a/client/src/main/resources/html/docs/PostProcessing.md +++ b/client/src/main/resources/html/docs/PostProcessing.md @@ -21,3 +21,38 @@ If you are running the server and want to run a post-processing script, you have 3. model name 4. site name 5. unixtime (seconds since 1/1/1970 00:00) + +##### Example Scripts + +Server script by @uo0Evx99@mastodon.cloud used on a Raspberry Pi 3 B+ to convert recordigns to mp4 files: +``` +#!/bin/bash + +# +#Explanation of the code: It first takes all the .ts files (because sadly the server +#doesnt save the video in 1 big file instead) and creates one big .ts file in the same +#folder called "all". +# +#Then it uses ffmpeg to re-encode the .ts file to .mp4 while just copying the audio +#and video codec to reduce the encoding time. It also uses the -movflags faststart so +#the video can be played back instantly when viewing online (e.g. with Plex) +#That re-encoded file is being stored in the folder /home/pi/hdd/plex/"MODEL NAME"/ +#with the name "CURRENT TIME"-"MODEL NAME".mp4 +# +#Then it deletes the folder in which all the .ts files were, because we dont need +#those anymore as we have our .mp4 file re-encoded already and ready to use/stream. +# +#This script has been used on a Raspberry Pi 3 B+ +# + +# $1 directory (absolute path) +# $2 file (absolute path) +# $3 model name +# $4 site name +# $5 unixtime + +# format unixtime to human readable +TIME=$(date --date="@$5" +%H:%M_%d.%m.%Y) + +cat $2/*.ts > "$2/all.ts" && ffmpeg -i "$2/all.ts" -acodec copy -vcodec copy -movflags faststart "/home/pi/hdd/plex/$3/$TIME-$3.mp4" && rm -r "$2" +``` \ No newline at end of file