VideoHelp Forum
+ Reply to Thread
Page 2 of 3
FirstFirst 1 2 3 LastLast
Results 31 to 60 of 65
Thread
  1. What are the best options to be given to ffmpeg to run it in batch mode
    I am using ffmpeg -hide_banner -nostats -loglevel quiet
    What do you suggest
    Regards,
    Kamalakar
    Quote Quote  
  2. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Yes there is but it may be a bad idea.

    1>NUL added to the end of an output statement will suppress STDOUT and 2>NUL will suppress STDERR
    You can simply add 2>NUL to the end of your batch and it will put the output only the first statements unless you follow them with 1>NUL

    Code:
    @echo off
    set folder_name ="c:\users\bud\desktop"
    cd %folder_name%
    rem cd upload
    set input_file="[dp]Manjandani-1.mp4"
    set output_file="4.mp4"
    set srt_file="frame.srt"
    echo input file name is %input_file% 
    echo output file name is %output_file% 
    echo srt file name is %srt_file% 
    
    ffmpeg -i %input_file% -vf "subtitles='%srt_file%:force_style=Fontsize=24,PrimaryColour=&H000000ff&'"^
     -vcodec libx264 -crf 22 -r 23.976 -acodec aac -ac 2 -ar 44.1k -b:a 128k^
     %output_file% 2>NUL
    Image
    [Attachment 44167 - Click to enlarge]


    The bad idea is that if you already have a copy of 4.mp4 you will not see the question asking if you want to override and the cmd window will just sit there unless you realize it and type y.
    Image
    [Attachment 44168 - Click to enlarge]


    If you wish to keep a log in case it hangs that you can open to look at then add 2> output.txt 1>&2
    to the end of the bat file and all will be written to a log file (output.txt) which you should be able to open if the batch fails or hangs

    Code:
    @echo off
    set folder_name ="c:\users\bud\desktop"
    cd %folder_name%
    rem cd upload
    set input_file="[dp]Manjandani-1.mp4"
    set output_file="4.mp4"
    set srt_file="frame.srt"
    echo input file name is %input_file% 
    echo output file name is %output_file% 
    echo srt file name is %srt_file% 
    
    ffmpeg -i %input_file% -vf "subtitles='%srt_file%:force_style=Fontsize=24,PrimaryColour=&H000000ff&'"^
     -vcodec libx264 -crf 22 -r 23.976 -acodec aac -ac 2 -ar 44.1k -b:a 128k^
     %output_file% 2> output.txt 1>&2
    Image
    [Attachment 44169 - Click to enlarge]
    Quote Quote  
  3. I am not sure weather this is correct or not. I am using start /b /wait /high ffmpeg to run the command at high priority.
    I ma not sure weather it makes any difference than using only ffmpeg command directly.
    Regards
    Kamalakar
    Quote Quote  
  4. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Strictly your choice... To me /b and /wait are simply choices if you wish but in my opinion not necessary for this batch file run. /High will not make it run faster unless you have another application hungry for CPU time then the highest priority gets the time. If it works better then I would say use them. If you don't see a difference then they are probably not needed.
    Quote Quote  
  5. Is there any easy way to upload multiple videos with one click. say 10 to 15 at a time instead of one at a time
    Regards
    Kamalakar
    Quote Quote  
  6. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Upload??? Do you mean hardcode subtitles or should this be a different question in a different post? You can send me a private message also so this thread doesn't just become a conversation that might not help others that read it.
    Quote Quote  
  7. Is there any easy way to upload multiple videos with one click.
    Use FOR .. DO

    You could use FOR /F to process files listed in a text file like

    Code:
    for /F "tokens=1,2,3" %%G in (FileList.txt) do ffmpeg -i "%%G" -vf subtitles="%%H" "%%I"
    with each lines in FileList.txt having the names of your input file, subtitle file and output file.
    Quote Quote  
  8. Sir, Since the file names are creating issues, using Excel VBA i have simplified the file names as 1.mp4,2.mp4 etc and srt files as 1.srt,2.srt etc and the output files i asked it to name it as 100001.mp4,100002.mp4 etc...

    and using the simple excel formulas i have developed the codes for each and every file.

    start /b /wait /high ffmpeg -hide_banner -nostats -loglevel quiet -i 454.mp4 -vf "subtitles='454.srt:force_style=Fontsize=24' " 100454.mp4
    start /b /wait /high ffmpeg -hide_banner -nostats -loglevel quiet -i 455.mp4 -vf "subtitles='455.srt:force_style=Fontsize=24' " 100455.mp4
    start /b /wait /high ffmpeg -hide_banner -nostats -loglevel quiet -i 456.mp4 -vf "subtitles='456.srt:force_style=Fontsize=24' " 100456.mp4

    for all the files i have to hard code, above is for the 454,455 and 456 files

    Regards,
    kamalakar
    Quote Quote  
  9. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    You can use the same batch to process multiple files. Create a folder with all your MP4's and SRT's (with same name)and add a batch file containing:

    Code:
    for %%a in (*.mp4) do start /b /wait /high ffmpeg -hide_banner -nostats -loglevel quiet^
     -i "%%a" -vf "subtitles='%%~na.srt:force_style=Fontsize=24' " 100%%~na.mp4
    Image
    [Attachment 44178 - Click to enlarge]


    This will create the files with embedded subtitles as '100xxx.mp4' names.

    Image
    [Attachment 44179 - Click to enlarge]
    Quote Quote  
  10. Message to you from the person of the spiritual organisation whom i am serving this as a service.

    Respected BudeMan

    thanks a million for your know-how.

    your help allowed us to hard code English subtitles into 1080 five minute clips in 28 hours.
    This is a big victory for us, as we are working in 90 languages and want to hard code many of them.

    sincerely
    Visnu Murti dasa

    if you are interested you can go through our links
    https://www.youtube.com/playlist?list=PLhQvESfduXoCEZymK-EODiN76S9FDEOA2
    https://vanimedia.org
    Quote Quote  
  11. Sir,
    How to subtitle Telugu langauge ie UTF-8 in ffmpeg

    I tried the following command . but it is not hard coding properly. the characters appear distorted.

    ffmpeg -sub_charenc [UTF-8] -i 851.mp4 -vf "subtitles='851.srt:force_style=Fontsize=24' " 100851.mp4


    Regards
    Kamalakar
    Quote Quote  
  12. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Distorted how? Blurry? Wrong? do you have an example?
    Quote Quote  
  13. Sir,
    Appreciate you replying back.

    Kindly find the images shown on the screen. In the file named distorted, distored words are shown by circling them in red colour.
    Kindly also the proper one.jpg to see how it is supposed to be.
    Regards
    Kamalakar
    Image Attached Thumbnails Click image for larger version

Name:	distorted.jpg
Views:	207
Size:	132.5 KB
ID:	44385  

    Click image for larger version

Name:	proper_one.jpg
Views:	199
Size:	121.7 KB
ID:	44386  

    Quote Quote  
  14. Kindly find the srt file i am using
    https://files.videohelp.com/u/274393/851.srt
    Quote Quote  
  15. Explorer Case's Avatar
    Join Date
    Feb 2004
    Location
    Middle Earth
    Search Comp PM
    That difference looks like a font issue. I had two fonts installed that support Telugu glyphs (Arial Unicode and Kohinoor Telugu). Both have the same-height glyphs where your second example shows the ‘hanging’ glyphs (partially below the baseline). I didn’t see the hanging glyphs on my system because of this. I expect ffmpeg to utilize Arial and Arial Unicode by default. Perhaps you can specify a different font for use in your subtitles?
    There may be more to it, as rendering Telugu script has its challenges, but font Lohit is distinctly different.
    Last edited by Case; 13th Jan 2018 at 09:52.
    Quote Quote  
  16. Sir, I tried using the lohit font as described by you. but it didnot improve the situation.
    https://files.videohelp.com/u/274393/glyph_notfound.jpg

    See the error message it gave before it continued. Can you kindly suggest what i need to do.

    Regards
    Kamalakar
    Quote Quote  
  17. Sir,
    Google search shows we can use utf-8 characters using -sub_charenc utf-8

    I am using the command
    ffmpeg -i 1.mp4 -vf "subtitles='1.srt:force_style=Fontsize=24' " -sub_charenc utf-8 100001.mp4

    It gives an error saying Codec AVoption -sub_charenc (set input text subtitles character encoding) specified for output file #0 <100001.mp4 is not a encoding option

    Can any one suggest me how to use utf-8 in ffmpeg.

    Regards
    Kamalakar
    Quote Quote  
  18. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Sir, I tried using the lohit font as described by you. but it didnot improve the situation.
    https://files.videohelp.com/u/274393/glyph_not found.jpg
    0xc28 looks to be saved as unicode but not necessarily utf-8 if I'm not mistaken. Did you try to save as UTF-8?

    What was the last script you ran in it's entirety that you ran to get that error?

    -sub_charenc utf-8 is generally used when encoding a subtitle stream, not usually for hard coding. If you google it you will find it is mostly used for soft coding with mapping for the stream.
    Quote Quote  
  19. ffmpeg -i 851.mp4 -vf "subtitles=851.srt:force_style=' FontName=Lohit-Telugu,Fontsize=24' " 100851.mp4

    I kept a copy of the font in the same folder where mp4 file is there and a copy of it is also present in windows system fonts folder

    the above code Gives me glpyh not found using selecting one more font for lohit-telugu

    So kindly suggest what should i do to get hard coding done properly.

    For me it doesnot matter which font it is as long as it hard codes the files properly
    Quote Quote  
  20. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    My research looks like it changes characters from different methods but still does not allow below the line characters/symbols in ffmpeg.

    I copied and pasted part of your subtitles into notepad and set saved as Unicode and UTF-8. FFmpeg accepted both with the same results in both. Then I used subtitle edit to change the SRT into ASS format with code page 57005 (Telugu) . You have to change your script to change the word [subtitle] to [ass]. I changed (in notepad) the defaults in the ASS file to Character size 40 and Font to Lohit Telugu and saved as unicode and UTF-8. The results were definitely different than the first test but I have no idea what either sentence says so I don't know if the font is correct but it did not show below the line on any of them.

    Still checking... still intrigued...
    Quote Quote  
  21. I tried this command a few minutes back

    ffmpeg -i 851.mp4 -vf "ass=851.ass" 1000851.mp4

    I converted my srt to ass file using ffmpeg -1 851.srt 851.ass

    The problem reamained the same
    Quote Quote  
  22. Sir, can you kindly post picture of the result when you said the result is definitely different. So that i can check if it has done correctly or not
    Quote Quote  
  23. Dear Budeman Sir,
    I tried many ways with ffmpeg google search. looks ffmpeg cannot do it for utf-8. it is good for english subtitles.
    Hand brake does not have the capability to adjust the font size
    Avidemux, is not giving enough time for the user to read subtitles

    Do you have experience of any other software that has programming capability to hard code subtitles in utf-8 to a video so that i can hard code multiple videos at a time.
    Regards
    Kamalakar
    Quote Quote  
  24. You can use .ass subtitles with HandBrakeCLI and do your hardcoding.

    First you need to decide on the font to use.

    I downloaded the subtitles from your post #44 and converted them to .ass format with UTF-8 encoding in Subtitle Edit.

    As pointed to by Case in post #44 the difference in your distorted.jpg and proper_one.jpg in post #43 could be due to the font used so I defined three .ass styles with Arial (Top), Lohit Telugu (Middle) and TenaliRamakrishna (Bottom) fonts.

    As pointed out by sneaker in your other thread you need to mux the subtitle with the video in order to hardcode with HandBrakeCLI.

    I did that with ffmpeg:

    ffmpeg -i video.mkv -i 851.ass -codec copy temp.mkv

    Then I hardcoded with HandBrakeCLI:

    handbrakecli --subtitle 1 --subtitle-burned -i temp.mkv -o video.mp4

    For the 8th subtitle in your 851.srt

    Image
    [Attachment 44403 - Click to enlarge]


    the three fonts looks like this:

    Image
    [Attachment 44404 - Click to enlarge]


    I don't know Telugu so you need to decide which font looks "proper" to you. To me they all look proper but I noticed a difference in the 2nd subtitle depending on the font used

    Image
    [Attachment 44405 - Click to enlarge]


    that I marked in the image below

    Image
    [Attachment 44406 - Click to enlarge]


    From the above you'll see even though a size of 24 pt is used for all three font their size appears different when hardcoded. Your 851.srt is rather messy without any line breaks so when hardcoding HandBrakeCLI inserts line breaks as needed depending on the font and size

    In Subtitle Edit you edit the default style to the font/size/color you need. These settings will be used when you batch convert all of your .srt files.

    This is done in a command window with the command:

    [Path to Subtitle Edit]subtitleedit /convert *.srt AdvancedSubStationAlpha

    If your files now are named 454.mp4, 454.ass, 455.mp4, 455.ass ... then your batch job looks like:

    Code:
    for %%g in (*.mp4) do (
    ffmpeg -i %%g -i %%~ng.ass -codec copy %%~ng.mkv
    handbrakecli --subtitle 1 --subtitle-burned -i %%~ng.mkv -o %%~ng_HC.mp4
    )
    You can elaborate on this to suit your need.
    Quote Quote  
  25. Dear Sir,
    This is excellent. This is great help.

    I am a beginner so i was trying to achieve this with one tool only, Any how combination of tools works. Great


    I am able to see bigger font with out any issues. My problem is solved

    Why did ffmpeg failed to properly place the telugu font. we have also seen this problem with gujarathi and hindi fonts too.



    I have more more than 100 files to do. I have used subtitle edit software to convert my files in .ass format.
    is there any software which can change the font size of all the .ass files

    Regards
    Kamalakar
    Quote Quote  
  26. s there any software which can change the font size of all the .ass files
    When you convert .srt to .ass with Subtitle Edit the font size in the .ass will be the one you use in the default style.

    Image
    [Attachment 44408 - Click to enlarge]
    Last edited by videobruger; 15th Jan 2018 at 09:15.
    Quote Quote  
  27. yes, I am able to see now. After setting the format to .ass by clicking on the style button next to ass i am able to get the above screen and can change all files format and style.
    Great help.
    Regards
    Kamalakar
    Quote Quote  
  28. And since size of the subtitle is a mojor issue for you this is for your info.

    In an .ass file beside setting the font size also the resolution of the display may or may not be set by PlayResX/PlayResY:

    Image
    [Attachment 44409 - Click to enlarge]


    Of course if PlayResX/PlayResY is set the subtitles are scaled accordingly.

    In your case PlayResX/PlayResY is not set so you get this message from HandBrakeCLI:

    Image
    [Attachment 44410 - Click to enlarge]


    As I said this is for your info and should have no consequence in your project.
    Last edited by videobruger; 15th Jan 2018 at 07:53.
    Quote Quote  
  29. Sir,
    FFMPEG is also an excellent tool. But Why did it fail in UTF-8 fonts.
    Regards,
    Kamalakar
    Quote Quote  
  30. I think the code has to be changed to
    for %%g in (*.mp4) do (
    ffmpeg -i %%g -i %%~ng.ass -codec copy %%~ng.mkv
    handbrakecli --subtitle 1 --subtitle-burned -i %%~ng.mkv -o %%~ng_HC.mp4
    del temp.mkv
    )

    Other wise in a batch run it keeps on asking should i overwrite temp.mkv
    Regards
    kamalakar
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!