add ffmpeg stuff

This commit is contained in:
NaiJi ✨ 2024-02-22 00:09:41 +04:00
parent a4b7bf6456
commit d418b910b9
2 changed files with 12 additions and 4 deletions

View File

@ -221,10 +221,11 @@ mode "$mode_system" {
} }
bindsym $mod+Shift+M mode "$mode_media" bindsym $mod+Shift+M mode "$mode_media"
set $mode_media (p)lay, (u)pdate music, (r)ecord, (s)top set $mode_media (p)lay, (u)pdate music, (r)ecord, (m)ic record, (s)top
mode "$mode_media" { mode "$mode_media" {
bindsym p exec mpv $(xclip -o), mode "default" bindsym p exec mpv $(xclip -o), mode "default"
bindsym r exec /home/naiji/.local/bin/media-util record, mode "default" bindsym r exec /home/naiji/.local/bin/media-util record, mode "default"
bindsym m exec /home/naiji/.local/bin/media-util record mic, mode "default"
bindsym s exec /home/naiji/.local/bin/media-util stop && notify-send -e -t 1000 -i video "ffmpeg" "done", mode "default" bindsym s exec /home/naiji/.local/bin/media-util stop && notify-send -e -t 1000 -i video "ffmpeg" "done", mode "default"
bindsym u exec mpc clear && systemctl --user restart mpd.service && mpc update && mpc add / && mpc play, mode "default" bindsym u exec mpc clear && systemctl --user restart mpd.service && mpc update && mpc add / && mpc play, mode "default"

View File

@ -21,12 +21,19 @@ then
if [ $1 == 'shrink' ] if [ $1 == 'shrink' ]
then then
ffmpeg -i "$2" -vcodec libx264 -crf 20 -filter:v fps=25 "$3" ffmpeg -i "$2" -vcodec libx264 -crf 15 -filter:v fps=25 -s 1280x720 -c:a copy "$3"
fi fi
if [ $1 == 'record' ] if [ $1 == 'record' ]
then then
ffmpeg -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i 57 ~/Videos/$(date "+%F-%N").mkv & device_id=$(pactl list short sources | grep output | awk '{print $1}')
if [ $2 == 'mic' ]
then
microphone_id=$(pactl list short sources | grep input | awk '{print $1}')
ffmpeg -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i $device_id -f pulse -ac 2 -i $microphone_id -filter_complex "[1:0][2:0]amix=inputs=2:duration=shortest" ~/Videos/$(date "+%F-%N").mkv &
else
ffmpeg -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i $device_id ~/Videos/$(date "+%F-%N").mkv &
fi
echo "$!" > ~/.local/share/ffmpeg/recent-recording echo "$!" > ~/.local/share/ffmpeg/recent-recording
fi fi
@ -43,7 +50,7 @@ else
echo "cut:" echo "cut:"
echo "ffmpeg -i \$2 -ss \$3 -t \$4 -c:v copy -c:a copy \$5" echo "ffmpeg -i \$2 -ss \$3 -t \$4 -c:v copy -c:a copy \$5"
echo "shrink:" echo "shrink:"
echo "ffmpeg -i \$2 -vcodec libx264 -crf 20 -filter:v fps=25 \$3" echo "ffmpeg -i \$2 -vcodec libx264 -crf 15 -filter:v fps=25 -s 1280x720 -c:a copy\$3"
echo "record:" echo "record:"
echo "ffmpeg -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i 57 ~/Videos/\$(date \"+%F-%N\").mkv &" echo "ffmpeg -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i 57 ~/Videos/\$(date \"+%F-%N\").mkv &"
echo "cue:" echo "cue:"