翻看某本书时,看到有些很重要的win10上很重要的
ffmpeg命令
批处理脚本,特此记录下,便于查阅:
set size=1280x720
set vbit=1000k
set abit=128k
set filename=%~dpn1
set ext=%~x1
ffmpeg -i "%filename%%ext%" -s %size% -vcodec h264 -acodec aac -b:v %vbit% -b:a %abit% -y "%filename%_%size%_%vbit%_%abit%.mp4"
pause
set start=5
set lenth=10
set filename=%~dpn1
set ext=%~x1
ffmpeg -ss %start% -t %lenth% -i "%filename%%ext%" -vcodec copy -acodec copy "%filename%_%start%_%lenth%_%ext%"
pause
set size=640x360
set start=5
set lenth=10
set rate=25
set filename=%~dpn1
set ext=%~x1
ffmpeg -ss %start% -t %lenth% -i "%filename%%ext%" -r %rate% -s %size% "%filename%_%start%_%lenth%.gif"
pause
set time=5
set filename=%~dpn1
set ext=%~x1
ffmpeg -ss %time% -i "%filename%%ext%" -frames:v 1 -y "%filename%_%time%.jpg"
pause
set size=640x360
set time=5
set filename=%~dpn1
set ext=%~x1
ffmpeg -ss %time% -i "%filename%%ext%" -s %size% -frames:v 1 -y "%filename%_%size%_%time%.jpg"
pause
set filename=%~dpn1
set ext=%~x1
ffmpeg -i "%filename%%ext%" -vcodec copy -acodec copy "%filename%.mp4"
pause
set file="D:\zjiac_code\uploadPath\test\danao.mp4"
set rtmp=rtmp://192.168.196.100:1935/live/stream
set size=960x540
set vbit=500k
set abit=64k
ffmpeg -re -i "%file%" -s "%size%" -c:v h264 -c:a aac -b:v %vbit% -b:a %abit% -f flv -y "%rtmp%"
pause
chcp 65001
set v="hm1091_techfront"
set a=" 外接麦克风 (Synaptics Audio)"
set url=rtmp://192.168.196.100:1935/live/livestream
ffmpeg -f dshow -i video=%v%:audio=%a% -f gdigrab -framerate 15 -i desktop -filter_complex "[0]scale=640:360[pip];[1][pip]overplay=main_w-overlay_w-0:main_h-overlay_h-40" -vcodec libx264 -acodec aac -b:v 750k -b:a 64k -s 1366x768 -f flv %url%
pause
set input=rtmp://192.168.196.100:1935/live/stream
set dir=%userprofile%\Videos
set file=%date:~0,4%%date:~5,2%%date:~8,2%_%time:~0,2%%time:~3,2%%time:~6,2%
ffmpeg -i "%input%" -vcodec copy -acodec copy -f flv -y "%dir%\%file%.flv"
pause
taskkill /f /im cmd.exe /t
pause
set input=%1
ffplay -x 640 -y 360 %input%
pause
set file=%date:~0,4%%date:~5,2%%date:~8,2%_%time:~0,2%%time:~3,2%%time:~6,2%
set dir=%~dp0
ffmpeg -f gdigrab -framerate 15 -i desktop -vcodec h264 -acodec aac -b:v 3000k -b:a 64k "%dir%\%file%.mp4"
pause
以上内容来自《零基础搭建直播室与云直播平台 》一书。
相关源码地址: https://gitee.com/senior-study-course/learn-live-play.git
大功告成!!!