DEFCONFIG/BOARD: minimize ffmpeg build & use libx264 for video rec (#117)

* BOARD: update Video Record app (video_record.sh)
* DEFCONFIG: minimize ffmpeg build
This commit is contained in:
Apaczer
2024-08-07 21:27:07 +02:00
committed by GitHub
parent eafadce373
commit eadda580e9
7 changed files with 52 additions and 6 deletions

View File

@@ -17,5 +17,5 @@ else
echo -en "Invalid video/audio format!"
# We're using SDL terminal to display above echo msg
## because all stdout is parsed to /dev/null from gmenu2x and it's child ps
st -k -e "/bin/sh" "-c" "echo -e \"\n\n\n\n\n\n Invalid video or audio format!\"; read -t 2"
st -k -e "/bin/sh" "-c" "echo -e \"\n\n\n\n\n\n\t\t\tInvalid video or audio format!\nExiting...\"; read -t 5"
fi

View File

@@ -1,7 +1,18 @@
#!/bin/sh
st_exec_func(){
st -k -e "/bin/sh" "-c" "${1}"
}
OUTPUTDIR="/mnt/output"
if pgrep "ffmpeg" > /dev/null; then
pkill ffmpeg
st_exec_func "pkill ffmpeg >/dev/null;\
echo -e \"\n\n\n\n\n\n\t\t\tExiting VIDEO recording!\nWait a minute to end writing MP4 file to ${OUTPUTDIR}/\";\
while pgrep ffmpeg >/dev/null; do sleep 1; done"
else
mkdir -p /mnt/output
ffmpeg -f fbdev -r 8 -i /dev/fb0 -c:v mpeg4 -framerate 15 "/mnt/output/video_$(date +%Y%m%d%H%M%S).mp4" -nostdin
mkdir -p ${OUTPUTDIR}
ffmpeg -f fbdev -r 10 -i /dev/fb0 -vf "format=yuv420p"\
-c:v libx264 -preset ultrafast -framerate 10 "${OUTPUTDIR}/video_$(date +%Y%m%d%H%M%S).mp4" -nostdin -loglevel warning &
# Wait a few seconds before actual screen record, the X264 encoder needs resources before it will stabilize video ouput
st_exec_func "echo -e \"\n\n\n\n\n\n\t\t\tStarting VIDEO record...\n\t\t\tWait a few seconds to start.\"; read -t 10"
fi

View File

@@ -1,4 +1,3 @@
title=VIDEO Rec
description=Start/Stop recording FB0 video in the background
exec=/mnt/apps/ffmpeg/video_record.sh
params=&
exec=/mnt/apps/ffmpeg/video_record.sh