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
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 31 to 60 of 65
Thread
-
-
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
[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.
[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
[Attachment 44169 - Click to enlarge] -
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.
-
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 -
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.
-
Is there any easy way to upload multiple videos with one click.
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"
-
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 -
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
[Attachment 44178 - Click to enlarge]
This will create the files with embedded subtitles as '100xxx.mp4' names.
[Attachment 44179 - Click to enlarge] -
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 -
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 -
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 -
Kindly find the srt file i am using
https://files.videohelp.com/u/274393/851.srt -
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 08:52.
-
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 -
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 -
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
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. -
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 -
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... -
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
-
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 -
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
[Attachment 44403 - Click to enlarge]
the three fonts looks like this:
[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
[Attachment 44405 - Click to enlarge]
that I marked in the image below
[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 )
-
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 -
s there any software which can change the font size of all the .ass files
[Attachment 44408 - Click to enlarge]Last edited by videobruger; 15th Jan 2018 at 08:15.
-
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 -
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:
[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:
[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 06:53.
-
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
Similar Threads
-
Batch script for forcing subtitles on MKV files.
By hemstock in forum SubtitleReplies: 2Last Post: 9th Oct 2015, 15:40 -
Batch muxing video files with subtitles
By calexicoca in forum SubtitleReplies: 4Last Post: 16th May 2015, 09:31 -
Using Ffmpeg to hard code subtitles
By wotdefcuk in forum SubtitleReplies: 21Last Post: 8th May 2014, 10:01 -
Free Video Encoder With Hard Code Subtitles Option Works on Server 2008
By lib3rty1 in forum Newbie / General discussionsReplies: 9Last Post: 3rd Oct 2013, 08:33 -
x264 CLI How to Hard-code Subtitles?
By dark_cross in forum SubtitleReplies: 4Last Post: 8th Apr 2013, 20:06