Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enabledelayedexpansion
- :: Look for all .webm files in the directory
- for %%f in (*.webm) do (
- set "filename=%%~nf"
- set "fullfile=%%f"
- :: Use string manipulation to extract the audio URL
- for /f "tokens=2 delims=[]" %%a in ("!filename!") do (
- set "tag=%%a"
- for /f "tokens=2 delims==" %%b in ("!tag!") do (
- set "escaped_url=%%b"
- set "url=!escaped_url:%%2F=/!"
- :: Decode %2F to / (you can add more decode cases if needed)
- set "url=!url:%%2E=.!"
- set "url=!url:%%3A=:!"
- set "url=!url:%%3F=?!"
- set "url=!url:%%26=&!"
- set "url=!url:%%3D==!"
- :: Generate base name (remove [sound=...] tag)
- set "basename=%%~nf"
- for /f "tokens=1 delims=[" %%c in ("!basename!") do (
- set "basename=%%c"
- )
- echo Processing !fullfile! with audio from !url!
- :: Download the audio
- curl -L -o "temp_audio.mp3" "!url!"
- :: Combine video and audio
- ffmpeg -y -i "!fullfile!" -i "temp_audio.mp3" -c:v copy -c:a aac -shortest "!basename!.mp4"
- del temp_audio.mp3
- )
- )
- )
- echo Done.
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement