forked from j62/ctbrec
Add example script by @uo0Evx99@mastodon.cloud
This commit is contained in:
parent
165e49d8e7
commit
c672750d10
|
@ -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"
|
||||
```
|
Loading…
Reference in New Issue