各位大大好 我最近接觸FFMPEG 參數都是網路上獲得 對於調整清晰度沒啥概念
我用BAT檔來對FLV 轉TS 再把TS合併成MP4
@echo off
setlocal enableDelayedExpansion
REM Change the code page for UTF8
set /p Patch=Enter Patch:
set Patch1=./%Patch%
set outfilename=%Patch%.mp4
color 2F && title 合併檔案:%~dp0%Patch%
for %%i in (./%Patch%/video/*.flv) do (
set fileName=%%i
set Video=%Patch%\video\!fileName!
set Sound=%Patch%\sound\!fileName!
set string=!fileName!
set string=!string:.flv=!
set OuputFN=!string!.ts
set OutputFile=%Patch%\!OuputFN!
for /f "tokens=1,2 delims=^=" %%g in ('..\..\ffprobe -hide_banner -show_entries format^=duration^ -sexagesimal %~dp0!Video! 2^>^&1') DO (
if "%%~g"=="duration" set "catduration=%%~h"
)
"../../ffmpeg" -i %~dp0!Video! -i %~dp0!Sound! -ss 00:00:00 -t !catduration! -vcodec libx264rgb -pix_fmt bgr24 -b:v 1000k -minrate 1000k -maxrate 3000k -bufsize 1000k -max_interleave_delta 50000 -acodec aac -ab 128k -ar 44100 -vf setdar=dar=16/10,scale=780:-1:flags=bilinear,unsharp=3:3:0.8,hqdn3d=3.9,fps=15 -af aresample=resampler=soxr -vsync -1 -strict -2 -f mpegts -threads 2 -y %~dp0!OutputFile!
cls
)
>%Patch1%/list.txt (
for %%i in (%Patch%/*.ts) do (
echo file %%i
)
)
"../../ffmpeg" -f concat -i %Patch1%/list.txt -i ../../logo.png -filter_complex "overlay=0:0" -vcodec libx264rgb -pix_fmt bgr24 -b:v 1200k -minrate 1000k -maxrate 3000k -bufsize 1200k -x264opts opencl=1:opencl_device=0:partitions=all:aq-mode=2:aq-strength=1.20:b-adapt=2:b-bias=0:b-pyramid=2:bframes=3:cabac=1:crf-max=0:cqm=flat:deblock=3,2:direct=auto:ipratio=1.20:pbratio=1.25:keyint=300:me=umh:merange=24:min-keyint=30:mixed-refs=1:no-chroma-me=0:nr=0:no-dct-decimate=1:no-fast-pskip=1:no-psy=0:psy-rd=0.25,0.00:no-mbtree=0:qcomp=0.65:qpmax=69:qpmin=24:qpstep=8:ratetol=10.5:ref=4:scenecut=40:subme=7:threads=2:trellis=2:vbv-init=0.9:weightb=1:weightp=2 -max_interleave_delta 50000 -acodec copy -movflags +faststart -y %outfilename%
cls
rd .\%Patch% /q /s
Pause ...
我是用-vcodec libx264rgb -pix_fmt bgr24 這個轉影像 用肉眼看是不錯清晰度還夠
在第二次是合併順便把水印打上
但是為什麼合併總會出現Non-monotonous DTS in output stream?
還有我的參數有甚麼地方要改進嗎?




























































































