[BOARD/PACKAGE] add FFMPEG to record&play /dev/fb0 + alsa capture (#48)

* [PACKAGE] downgrade FFMPEG(add) & X264
- use ffmpeg-3.1 thus downgrade ver. to working SDL1.2
- downgrade x264 to be inline with former ffmpeg
- uncomment FFSERVER build instructions (it is available in 3.1 version)

* [BOARD] 
- add `ffplay` & `ffmpeg` apps to record&play
- add `arecord` script for AUDIO capture (use alsaloop workaround)
- update appLinks with "params=&" for bg launch
- use `pkill` instead 'killall` for scripts (warning: it also checks for bash running under the same name)
- use FFPROBE to detect media format in `ffplay`
- for X264  use sources.buildroot.net (code.videolan.org src only works with git method)
- rm redundant usb Applink
- add 0003-ffplay-custom-sdlk.patch (to make hotkeys usable in miyoo)
This commit is contained in:
Apaczer
2023-11-18 17:27:30 +01:00
committed by GitHub
parent b7a8ba56ec
commit 423e87bd64
25 changed files with 212 additions and 366 deletions

View File

@@ -0,0 +1,18 @@
#!/bin/sh
if pgrep "arecord" > /dev/null; then
killall arecord
while (pgrep "arecord"); do
sleep 1
done
rmmod snd-aloop.ko
rm /mnt/.asoundrc
alsactl init
else
#WARNING: This disables audio output to speakers by redirecting it to alsaloop capturing device's card
echo 'pcm.!default { type plug slave.pcm "hw:Loopback,0,0" }' > /mnt/.asoundrc
modprobe snd-aloop.ko
alsactl init
mkdir -p /mnt/output
arecord -q -c2 -D hw:Loopback,1,0 -f S16_LE "/mnt/output/audio_$(date +%Y%m%d%H%M%S).wav"
fi

View File

@@ -0,0 +1,12 @@
#!/bin/sh
if ffprobe -v error -select_streams v:0 -show_entries stream=codec_type "$1" | grep -q "video"; then
ffplay -autoexit -i "$1"
elif ffprobe -v error -select_streams a:0 -show_entries stream=codec_type "$1" | grep -q "audio"; then
ffplay -nodisp -autoexit -i "$1"
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
/mnt/apps/st/st -e "/bin/sh" "-c" "echo -e \"\n\n\n\n\n\n Invalid video or audio format!\"; sleep 2"
fi

View File

@@ -0,0 +1,11 @@
FFPLAY shortcuts:
-----------------------
ESCAPE ("Select") = quit
LSHIFT ("X"); f = fullscreen
SPACE ("Y"); RETURN ("Start")= pause
LCTRL ("B"); m = mute
RSHIFT/RALT ("R3/L3"); 0/9 = increase/decrease volume
LALT ("A"); s = step to next frame
LEFT/RIGHT (-) = Seek backward/forward 10 seconds.
DOWN/UP (-)= Seek backward/forward 1 minute.
PAGEUP/PAGEDOWN ("L2/R2")= Seek to the previous/next chapter. If there are no chapters seek backward/forward 10 minutes.

View File

@@ -0,0 +1,7 @@
#!/bin/sh
if pgrep "ffmpeg" > /dev/null; then
pkill ffmpeg
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
fi

View File

@@ -0,0 +1,5 @@
title=FFPLAY
description=Play a movie/audio file
exec=/mnt/apps/ffmpeg/ffplay_launch.sh
manual=/mnt/apps/ffmpeg/manual.txt
selectordir=/mnt/output

View File

@@ -0,0 +1,4 @@
title=AUDIO rec
description=Start/Stop recording alsa HW audio output
exec=/mnt/apps/arecord/audio_record.sh
params=&

View File

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

View File

@@ -1,3 +0,0 @@
title=USB change part.
description=USB switch FAT partition
exec=/mnt/apps/usb-serial-mass-storage/usb-change_primary_partition.sh