gemercheung 4 роки тому
батько
коміт
1744f3fae1
2 змінених файлів з 32 додано та 1 видалено
  1. 24 0
      gpu.md
  2. 8 1
      install-ffmpeg

+ 24 - 0
gpu.md

@@ -13,3 +13,27 @@ fmpeg -vsync 0 -framerate 24 -i images/%06d.jpg -c:v libx264 imagetovideo.mp4
 # video to video
 
 ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -i test-origin.mp4 -c:v h264_nvenc -b:v 5M output.mp4
+
+## re hls to rtmp
+
+ffmpeg -re -analyzeduration 8000 -probesize 200000 -i "http://39.135.138.8:6610/PLTV/88888888/224/3221225643/2/index.m3u8?fmt=ts2hls" -strict -2 -c:v copy -c:a copy -bsf:a aac_adtstoasc -f flv rtmp://192.168.0.52:1935/stream/test
+
+## re hls to rtmp
+
+ffmpeg -re -analyzeduration 8000 -probesize 200000 -i "https://nmxlive.akamaized.net/hls/live/529965/Live_1/index.m3u8" -i /home/gemer/Downloads/shuiyin.png -strict -2 -filter_complex "[0][1]overlay[out]" -map "[out]" -vcodec libx264 -bsf:a aac_adtstoasc -f flv rtmp://192.168.0.52:1935/stream/test
+
+http://39.135.138.8:6610/PLTV/88888888/224/3221225643/2/index.m3u8?fmt=ts2hls
+#EXTINF:-1,CCTV-3 综艺 高清
+http://39.135.138.8:6610/PLTV/88888888/224/3221225634/2/index.m3u8?fmt=ts2hls
+
+#EXTINF:-1,CCTV-5 体育 高清
+http://39.135.138.8:6610/PLTV/88888888/224/3221225633/2/index.m3u8?fmt=ts2hls
+#EXTINF:-1,CCTV-5+ 体育赛事 高清
+http://39.135.138.8:6610/PLTV/88888888/224/3221225706/2/index.m3u8?fmt=ts2hls
+## 2 hls to 1
+
+ffmpeg -re -analyzeduration 8000 -probesize 200000 -i "http://39.135.138.8:6610/PLTV/88888888/224/3221225643/2/index.m3u8?fmt=ts2hls" -i "http://39.135.138.8:6610/PLTV/88888888/224/3221225634/2/index.m3u8?fmt=ts2hls" -strict -2 -filter_complex "[0:v]pad=iw*2:ih[a];[a][1:v]overlay=w*1[out]" -map "[out]" -c:v h264_nvenc -bsf:a aac_adtstoasc -f flv rtmp://192.168.0.52:1935/stream/test
+
+## use cuda
+
+ffmpeg -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -re -analyzeduration 8000 -probesize 200000 -i "https://nmxlive.akamaized.net/hls/live/529965/Live_1/index.m3u8" -strict -2  -c:v h264_nvenc -bsf:a aac_adtstoasc -f flv rtmp://192.168.0.52:1935/stream/test

+ 8 - 1
install-ffmpeg

@@ -9,7 +9,7 @@ WORKSPACE="$CWD/workspace"
 CFLAGS="-I$WORKSPACE/include"
 LDFLAGS="-L$WORKSPACE/lib"
 LDEXEFLAGS=""
-EXTRALIBS="-ldl -lpthread -lm -lz"
+EXTRALIBS="-ldl -lpthread -lm -lz -lGLEW -lglfw"
 MACOS_M1=false
 CONFIGURE_OPTIONS=()
 useGitLib=""
@@ -721,8 +721,15 @@ fi
 
 build "ffmpeg"
 download "https://www.ffmpeg.org/releases/ffmpeg-4.4.tar.gz"
+
+curl -s https://raw.githubusercontent.com/numberwolf/FFmpeg-Plus-OpenGL/main/Plus-GL-Shader/vf_plusglshader.c  libavfilter/vf_plusglshader.c
+curl -s https://raw.githubusercontent.com/numberwolf/FFmpeg-Plus-OpenGL/main/Plus-GL-Shader/vf_lutglshader.c  libavfilter/vf_lutglshader.c
+
 # shellcheck disable=SC2086
 ./configure "${CONFIGURE_OPTIONS[@]}" \
+  --enable-opengl \
+  --enable-filter=plusglshader \
+  --enable-filter=lutglshader \
   --disable-debug \
   --disable-doc \
   --disable-shared \