Add ffmpeg with nvidia codec
This commit is contained in:
parent
421fd71e11
commit
86af034ed6
|
@ -1,8 +1,6 @@
|
|||
#!/bin/bash
|
||||
sudo add-apt-repository ppa:ubuntuhandbook1/ffmpeg6 -y
|
||||
sudo nala update
|
||||
sudo nala install -y \
|
||||
ffmpeg `# for video recording` \
|
||||
mpv `# for video playing` \
|
||||
sxiv `# for pictures` \
|
||||
strace `# for tracing` \
|
||||
|
@ -14,6 +12,21 @@ do
|
|||
sudo usermod -a -G $group $USER
|
||||
done
|
||||
|
||||
# install ffmpeg with nvidia
|
||||
if ! command -v ffmpeg &> /dev/null
|
||||
then
|
||||
git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg/
|
||||
git clone --depth 1 https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
|
||||
cd nv-codec-headers && sudo make install && cd -
|
||||
sudo nala install -y build-essential yasm cmake libtool libc6 libc6-dev unzip wget libnuma1 libnuma-dev libasound2-dev
|
||||
cd ffmpeg
|
||||
./configure --enable-nonfree --enable-cuda-nvcc --enable-libnpp --enable-libxcb --enable-indev=alsa --enable-outdev=alsa --extra-cflags=-I/usr/lib/cuda/include --extra-ldflags=-L/usr/lib/cuda/lib64 --disable-static --enable-shared
|
||||
make -j 8
|
||||
sudo make install
|
||||
cd -
|
||||
rm -rf ffmpeg nv-codec-headers
|
||||
fi
|
||||
|
||||
# install pet
|
||||
if ! command -v pet &> /dev/null
|
||||
then
|
||||
|
|
|
@ -34,7 +34,6 @@ pulseaudio `# for sound` \
|
|||
alsa-base `# for sound` \
|
||||
pavucontrol `# for audio control` \
|
||||
pasystray `# for audio control` \
|
||||
libnvidia-compute-545 `# for mpv + nvidia` \
|
||||
iputils-ping `# ping etc.` \
|
||||
xfe `# classic file manager` \
|
||||
surf `# suckless lightweight browser` \
|
||||
|
@ -44,7 +43,10 @@ psmisc `# pstree etc.` \
|
|||
slack \
|
||||
firefox \
|
||||
python3 \
|
||||
python3-venv
|
||||
python3-venv \
|
||||
libnvidia-compute-545 `# for mpv + nvidia` \
|
||||
nvidia-driver-545 `# nvidia driver` \
|
||||
nvidia-cuda-toolkit `# cuda driver`
|
||||
|
||||
# install telegram
|
||||
if [ ! -d /opt/Telegram ]
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#!/bin/bash
|
||||
ffmpeg \
|
||||
-f x11grab -framerate 30 -video_size 1920x1080 -i :0 `# this is screen` \
|
||||
-f v4l2 -framerate 30 -video_size 640x480 -i /dev/video0 `# this is camera` \
|
||||
-f alsa -i default `# this is audio` \
|
||||
export LD_LIBRARY_PATH=/usr/local/lib
|
||||
ffmpeg -hwaccel cuda -hwaccel_output_format cuda `# we need nvidia acceleration because of low fps without it` \
|
||||
-f x11grab -r 30 -video_size 1920x1080 -i :0 `# this is screen` \
|
||||
-f v4l2 -r 30 -video_size 640x480 -i /dev/video0 `# this is camera` \
|
||||
-f alsa -i default `# this is audio. Why not pulse? Nvidia?` \
|
||||
-c:v h264_nvenc `# this is video codec` \
|
||||
-filter_complex "[0][1]overlay=main_w-overlay_w-2:main_h-overlay_h-2[v]" -map [v] -map 2 `# this is for placing camera in bottom right corner. IDK how it works` \
|
||||
video.mp4 # ouput file
|
||||
video.mp4 # output file
|
||||
|
|
Loading…
Reference in New Issue