VideoHelp Forum


Try NordVPN to access Netflix or other streaming services from any country and also surf safely!
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. Member
    Join Date
    Apr 2018
    Location
    Sunsari [Nepal]
    Search Comp PM
    Hello Members

    I am trying to Watermark my videos using Batch Script,

    I Had Previously Created a .bat Files Which is almost Good

    and Now i am trying to add burn subtitle cmd but Getting error When i Run Batch File

    but i tried to print the final cmd, and When I Manually copy paste cmd and run then, it Worked For me

    Please Guide Me the exact issue, and How to Set subtitle Path on cmd

    I had added option to Crop (Top and Bottom)


    Please See Below

    Code:
    @echo off
    
    set %1
    set /p x=crop on Top (px):
    set /p y=crop on Button (px):
    set /a z = x + y
    echo %z%
    
    IF NOT DEFINED Title SET "Title=encoded"
    
    :MENU
    SET /P M= Choose Quality : Press [1] :
    
    
    IF %M%==1 GOTO 480
    
    :480
    echo "C:\Users\Alone\Downloads\Video\Screenshots\ffmpeg.exe" -i %1 -vf "ass=subtitle.ass, crop=w=iw:h=ih-0%z%:x=0:y=0%x%, scale=720:-4" -c:v libx264 -b:v 375k -minrate 375k -maxrate 375k -bufsize 375k -preset medium -c:a aac -b:a 48k "%~dpn1-%Title%-480p.mkv"
    Pause
    exit
    But when i Directly Run Cmd then i am Getting Error


    Please Help me to Fix this issue

    Thanks
    Quote Quote  
  2. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    Hi.
    I did only 1 test. It worked for me.

    Code:
    @echo off
    :: Output goes into the \New folder.
    if not exist New\ md New
    Title "%~n1"
    
    set /p x=crop on Top (px):
    set /p y=crop on Button (px):
    set /a z = x + y
    echo %z%
    
    
    :MENU
    SET /P M= Choose Quality : Press [1] :
    
    IF %M%==1 GOTO 480
    
    :480
    "C:\Users\Alone\Downloads\Video\Screenshots\ffmpeg.exe" -i "subtitle.ass" -i %1 -vf crop=w=iw:h=ih-0%z%:x=0:y=0%x%,scale=720:-4 -c:v libx264 -b:v 375k -minrate 375k -maxrate 375k -bufsize 375k -preset medium -c:a aac -b:a 48k -c:s ass "New\%~n1-encoded-480p.mkv"
    Pause
    exit
    My preference would be:
    Code:
    "C:\Users\Alone\Downloads\Video\Screenshots\ffmpeg.exe" -i "subtitle.ass" -i %1 -vf crop=w=iw:h=ih-0%z%:x=0:y=0%x%,scale=720:-4 -c:v libx264 -preset medium -crf 22 -c:a aac -b:a 128k -ar 48000 -c:s ass -threads 0 "New\%~n1-480p.mkv"
    If the cropping is the same for all your clips then I would set x : y only once, and then process all the clips in a folder.
    This requires several changes to your batch file.

    Perhaps this might be a better way to go.
    https://arccoder.medium.com/ffmpeg-add-a-logo-on-video-bf1f4652792a

    Cheers
    Last edited by pcspeak; 11th Jun 2021 at 17:35. Reason: Forgot the 'k' on audio bitrate :(
    Quote Quote  
  3. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Don't know if it was a finger check or not but the original example is missing the final quote after .ass
    "ass=subtitle.ass, crop=w=iw:
    Subtitles are fussy when i comes to double quotes, single quotes and escaping certain characters.
    .
    Quote Quote  
  4. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    Hi Budman1.

    Don't know if it was a finger check or not but the original example is missing the final quote after .ass
    You're right, but as the whole filter string was enclosed in double quotes, it's ok. Well, that technique works here.
    Code:
    -vf "ass=subtitle.ass, crop=w=iw:h=ih-0%z%:x=0:y=0%x%, scale=720:-4"
    I don't use the double quotes around filter strings as a rule. (As shown in the code in my previous post.)
    It's just another thing for me to get wrong.

    Cheers.
    Last edited by pcspeak; 12th Jun 2021 at 14:50.
    Quote Quote  



Similar Threads