Hi all. I apologize if this has been addressed before but I couldn't find anything searching Google or these forums so I hope I can get some help here. Whenever I try to convert video with -subtitles option, it takes more than 3 minutes for initialization to start the conversation with 800mb ram and 30% of my core i3 processor to render a 19mb sized video.
ffmpeg -i "J:\Do Ghoont Mujhe Bhi Pila De -Jheel Ke Us Paar.mp4" -vf "subtitles=subtitle.srt" -y "J:\out.mp4"
The information about input video (Media Info)::
----------------------------------------------------------------------------
General
Complete name : J:\Do Ghoont Mujhe Bhi Pila De -Jheel Ke Us Paar.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 18.9 MiB
Duration : 4mn 0s
Overall bit rate mode : Variable
Overall bit rate : 657 Kbps
Video
ID : 1
Format : MPEG-4 Visual
Format profile : Simple@L1
Format settings, BVOP : No
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default (H.263)
Codec ID : 20
Duration : 4mn 0s
Bit rate : 525 Kbps
Width : 320 pixels
Height : 240 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 24.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.285
Stream size : 15.1 MiB (80%)
Writing library : Lavc52.37.0
Language : English
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 4mn 0s
Bit rate mode : Variable
Bit rate : 128 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 3.67 MiB (19%)
Language : English
----------------------------------------------------------------------------
The sceenshot:
If I use ffMBC instead of ffMPEG, everything is fine and no waiting time.
Any idea what's going on? I have no idea how to fix it. Thanks all.
+ Reply to Thread
Results 1 to 6 of 6
-
-
I'm moving you to our video conversion section. This is not just audio related.
Does it ONLY happen with the subtitle option?
What ffmpeg version? Try different versions from http://ffmpeg.zeranoe.com/builds/ -
Thanks for your reply.
It happens only with subtitles filter.
I tested this on three version of ffMPEG downloaded from http://ffmpeg.zeranoe.com/builds/
1. ffmpeg version N-53818-gfca435f Copyright (c) 2000-2013 the FFmpeg developers
built on Jun 4 2013 01:36:26 with gcc 4.7.3 (GCC)
2. ffmpeg version N-53943-g0047da0 Copyright (c) 2000-2013 the FFmpeg developers
built on Jun 10 2013 01:13:31 with gcc 4.7.3 (GCC)
3. ffmpeg version N-56143-gd1a1656 Copyright (c) 2000-2013 the FFmpeg developers
built on Sep 9 2013 18:01:35 with gcc 4.7.3 (GCC)
But the result is same.
Can you specify which version should I use?
Thanks again. -
a. embedding subtitles is always slow (same with Avisynth)
b. subtitle embedding often can't be multithreaded and therefore might be a bottleneck
My guess: ffmpeg is build with libass, ffmbc isn't and rendering srt with libass might be slower than using the internal filter. (haven't verified this, but that's my first guess) Might also be that one does a color conversion to RGB and the other doesn't.
-> use higher loglevel settings to see better what's happening. -
Hi! Selur,
First, I want to respect your valuable time that you have spend to give response and your guess also, but Sir if you use FreeMake Video Converter for embedding subtitles, you will see that it takes no extra initialization time.
A guy already has posted the similar problem like me on ffmpeg.zeranoe.com/forum.
Now, I have found the way to get rid of this unwanted problem.
Actually we (Windows users) have to setup font paths to get libass to work and problem starts from here. If we specify the default font directory like below:
<dir>C:\WINDOWS\Fonts</dir>
in the fonts.conf and libass / ffmpeg will start searching in the system font directory for all available fonts. Take a look here and search for the '<dir prefix="default">' text, please. In fact, we specify only one font name in .ass, but ffmpeg / libass forces us to allocate unnecessary time, cpu and high memory usage to load all available fonts into memory instead of only one font that is specified in .ass. If we create an another directory having only specified font and replace the above said <dir>.....<dir> with <dir>Our_folder_name<dir>. And then nothing will happen to bother.
Steps details:
- First create a folder. Here we will use "C:\FontConfig"
- Open the folder and create a file named fonts.conf. Use Notepad to open the file and paste the below lines.
<?xml version="1.0"?>
<fontconfig>
<--
Replace the Directory name with your own.
-->
<dir>C:\FontConfig</dir>
<match target="pattern">
<test qual="any" name="family"><string>mono</string></test>
<edit name="family" mode="assign"><string>monospace</string></edit>
</match>
<match target="pattern">
<test qual="all" name="family" compare="not_eq"><string>sans-serif</string></test>
<test qual="all" name="family" compare="not_eq"><string>serif</string></test>
<test qual="all" name="family" compare="not_eq"><string>monospace</string></test>
<edit name="family" mode="append_last"><string>sans-serif</string></edit>
</match>
<alias>
<family>Times</family>
<prefer><family>Times New Roman</family></prefer>
<default><family>serif</family></default>
</alias>
<alias>
<family>Helvetica</family>
<prefer><family>Arial</family></prefer>
<default><family>sans</family></default>
</alias>
<alias>
<family>Courier</family>
<prefer><family>Courier New</family></prefer>
<default><family>monospace</family></default>
</alias>
<alias>
<family>serif</family>
<prefer><family>Times New Roman</family></prefer>
</alias>
<alias>
<family>sans</family>
<prefer><family>Arial</family></prefer>
</alias>
<alias>
<family>monospace</family>
<prefer><family>Andale Mono</family></prefer>
</alias>
<match target="pattern">
<test name="family" compare="eq">
<string>Courier New</string>
</test>
<edit name="family" mode="prepend">
<string>monospace</string>
</edit>
</match>
<match target="pattern">
<test name="family" compare="eq">
<string>Courier</string>
</test>
<edit name="family" mode="prepend">
<string>monospace</string>
</edit>
</match>
</fontconfig>
3. Save the file.
4. Use .ass file instead of .srt. If you have already a .srt file, you can convert it through ffmpeg using the following command:
ffmpeg -i input.srt output.ass
5. Now, open the .ass file and looks for the font name. It looks like..
Format: Name, FontName, FontSize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
Style: Default,Arial,20,&Hffffff,&Hff0c00,&H0,&H0,1,0,0,1,1,1,2,10,10, 10,0,0
6. Copy the font along with sub-font files from System Font Directory (C:\Windows\Fonts) to our created folder (C:\FontConfig), actually when copy the font, by default, windows copies the font along with its sub-font files also.
It means if you want to copy 'Arial', you need to copy "arial.ttf", "arialbd.ttf", "arialbi.ttf", "ariali.ttf", "ARIALN.TTF", "ARIALNB.TTF", "ARIALNBI.TTF", "ARIALNI.TTF" and "ariblk.ttf".
7. Now create environment variables like:
FC_CONFIG_DIR = C:\FontConfig
FONTCONFIG_FILE = fonts.conf
FONTCONFIG_PATH = C:\FontConfig
8. Now make a test running the following command:
ffmpeg -i input.avi -vf "subtitles=SubtitleFileName.ass"
9. I hope that all problems are gone.
In my last word, I would like to inform that I am not a technical guy and english is not my native language. So, if anything unwanted words are in my post, is excusable. I am just sharing my experience.
Thanks to all.
-
Ah, I see libass requires fontconfig to scan the system unless a fontconfig config file is present.
Similar Threads
-
ffmpeg CPU usage
By diprotic in forum Video ConversionReplies: 13Last Post: 19th Apr 2015, 14:40 -
Does FFMpeg have an option to limit the memory usage ?
By rajivrp in forum Video ConversionReplies: 4Last Post: 3rd Jul 2013, 04:14 -
Newbie - ffmpeg args for transcoding 1080p to 720p, etc.
By awatelet in forum Newbie / General discussionsReplies: 2Last Post: 28th Apr 2011, 13:21 -
help with ffmpeg args to convert .m4v to .m2v or .mpeg
By rhfritz in forum Video ConversionReplies: 3Last Post: 28th Apr 2011, 12:09 -
Is There Specific Memory Rams for Intel/AMD CPU?
By imdaman in forum ComputerReplies: 1Last Post: 26th Nov 2009, 23:47