ultravideo / uvg266

An open-source VVC encoder based on Kvazaar
BSD 3-Clause "New" or "Revised" License
225 stars 16 forks source link

How to batch convert multiple videos by using ffmpeg pipe uvg266? #25

Open jiangzemin-xudamin opened 1 month ago

jiangzemin-xudamin commented 1 month ago

I was originally using vvenc and I just came across the uvg266 today and I am not familiar with the use of this encoder. When using uvg266, if I choose to convert the original video file to YUV first, it means I have to enter the resolution every time; but if I convert to Y4M first, uvg266 skips frame headers by default, which will cause all the video to incorrectly play at 25 frames per second! .\ffmpeg -i 1.y4m -f yuv4mpegpipe -strict -2 - | .\uvg266 -i - --input-file-format y4m --qp 51 --preset faster -o output.266 When using vvenc, I can batch convert videos with the following batch command:

md temp

for %%a in (*.y4m *.mp4 *.webm *.mov *.avi *.rm *.rmvb *.flv *.3gp) do ( 
.\ffmpeg -i "%%~sa" -an -c:v libvvenc -preset 4 -b:v 0 -qp 26 ".\temp\%%~na.vvc"
)

pause

However, when I try to replace it with the uvg266, I get a flashback, what's wrong?

md temp

for %%a in (*.y4m *.mp4 *.webm *.mov *.avi *.rm *.rmvb *.flv *.3gp) do ( 
.\ffmpeg -i "%%~sa" -an -f yuv4mpegpipe -strict -2 - | .\uvg266 -i - --input-file-format y4m --qp 51 --preset faster ".\temp\%%~na.vvc"
)

pause
jiangzemin-xudamin commented 1 week ago

HOW???? This batch file will be used to batch compress images audio video. Using FFMPEG modified by Mr. MartinEesmaa, Using Exhale to convert audio, Using UVG266 to convert video, Encapsulate multimedia files using MP4BOX.

md output
for %%a in (*.wav *.mp3 *.flac *.m4a *.aac *.amr *.ogg) do (
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -vn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\output\%%~na.m4a"
)
for %%a in (*.png *.jpg *.jpeg *.heif *.avif *.jxl *.gif *.bmp) do (
.\ffmpeg_vvceasy -hide_banner -loglevel error -i "%%~sa" -pix_fmt yuv420p -strict -2 -f yuv4mpegpipe - | .\uvg266 -i - --input-file-format y4m --owf 58 --threads 32 --qp 35 --preset 9 -o ".\output\%%~na.266"
)

md temp
for %%a in (*.mkv *.mp4 *.webm *.mov *.avi *.rm *.rmvb *.flv *.3gp *.wmv) do (
md ".\temp\%%~na"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:s -an -vn -strict -2 -c:s copy ".\temp\%%~na\ssss.mkv"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:0 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\0.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:1 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\1.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:2 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\2.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:3 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\3.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:4 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\4.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:5 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\5.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:6 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\6.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:7 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\7.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:8 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\8.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:9 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\9.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:10 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\10.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:11 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\11.m4a"
.\ffmpeg_vvceasy -hide_banner -i "%%~sa" -map 0:a:12 -vn -sn -c:a pcm_s32le -threads 32 -strict -2 -ac 2 -f wav - | .\exhale b ".\temp\%%~na\12.m4a"
.\ffmpeg_vvceasy -hide_banner -loglevel error -i "%%~sa" -map 0:v:0 -an -sn -pix_fmt yuv420p -strict -2 -f yuv4mpegpipe - | .\uvg266 -i - --input-file-format y4m --owf 58 --qp 35 --preset 7 -o ".\temp\%%~na\vvvv.vvc"
mp4box -add ".\temp\%%~na\vvvv.vvc" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\0.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\1.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\2.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\3.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\4.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\5.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\6.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\7.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\8.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\9.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\10.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\11.m4a" ".\temp\%%~na\mmmm.mp4"
mp4box -add ".\temp\%%~na\12.m4a" ".\temp\%%~na\mmmm.mp4"
.\ffmpeg_vvceasy -hide_banner -i ".\temp\%%~na\mmmm.mp4" -i ".\temp\%%~na\ssss.mkv" -map 0:v -c:v copy -map 0:a -c:a copy -map 1:s -c:s copy -strict -2 ".\output\%%~na.mkv"
.\ffmpeg_vvceasy -hide_banner -n -i ".\temp\%%~na\mmmm.mp4" -map 0:v -c:v copy -map 0:a -c:a copy -strict -2 ".\output\%%~na.mkv"
.\ffmpeg_vvceasy -hide_banner -n -i ".\temp\%%~na\mmmm.mp4" -map 0:v -c:v copy ".\output\%%~na.mkv"
)
pause
rmdir /s/q temp
echo "!!!Conversion completed!!!"
pause
jiangzemin-xudamin commented 1 week ago

https://forum.doom9.org/showthread.php?p=2009792#post2009792 fraunhoferhhi/vvenc#464

@Jamaika1 I'm sorry that your response doesn't directly address my question

Jovasa commented 1 week ago

for %%a in (*.y4m *.mp4 *.webm *.mov *.avi *.rm *.rmvb *.flv *.3gp) do ( 
.\ffmpeg -i "%%~sa" -an -f yuv4mpegpipe -strict -2 - | .\uvg266 -i - --input-file-format y4m --qp 51 --preset faster ".\temp\%%~na.vvc"
)```

You are missing the -o flag

jiangzemin-xudamin commented 1 week ago

You are missing the -o flag

you are right。Additionally, can you help me modify it?https://github.com/ultravideo/uvg266/issues/25#issuecomment-2473782155

Jovasa commented 1 week ago

Additionally, can you help me modify it?#25 (comment)

Sorry, unfortunately I'm not really sure what you are trying to achieve and I'm not really an expert with MP4Box