Opened 12 years ago
Closed 12 years ago
#2100 closed defect (invalid)
No burned in subtitles visible on Mac OSX
Reported by: | raptor399 | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug
Burning in subtitles as described in the wiki does not work as advertised on Mac OSX 10.8.2 (Mountain Lion).
FFmpeg will run and convert the video, but no subtitles will be visible in the resulting video. Friends on Linux report the same command line works just fine for them, this appears to be an OSX specific problem.
A similar problem has also been reported on the ffmpeg-user mailinglist, alas no answer there.
How to reproduce
Downloaded the latest snapshot build for OSX and use this command line:
% ffmpeg -v 9 -loglevel 99 -report -i test.avi -vf subtitles=test.srt output.mpg
The file "test.srt" can be a very basic test file:
0 00:00:01,930 --> 00:00:03,800 Just testing subtitles 1 00:00:03,930 --> 00:00:05,300 Second line of subtitles and it is a long line 2 00:00:05,710 --> 00:00:07,320 Third line of subtitles, let's make it count! 3 00:00:07,770 --> 00:00:10,550 Fourth line of subtitles, which is not the last line.
Opening the file "test.avi" with VLC will display the subtitles correctly as it picks up "test.srt" automatically. Opening the converted "output.mpg" with VLC shows no subtitles.
I have tried this with .ass files and the "-vf ass=test.ass" filter, I have tried it with other input and output formats, never have I managed to get subtitles burned in on OSX.
Side note
On a perhaps related side note: as reported in ticket #1688, fontconfig will give lots of warnings:
Fontconfig warning: ignoring UTF-8: not a valid region tag Fontconfig warning: ignoring UTF-8: not a valid region tag Fontconfig warning: ignoring UTF-8: not a valid region tag
This happens because of the default locale on OSX:
% locale LANG= LC_COLLATE="C" LC_CTYPE="UTF-8" LC_MESSAGES="C" LC_MONETARY="C" LC_NUMERIC="C" LC_TIME="C" LC_ALL=
To silence these warnings LC_TYPE needs to be set to a valid value in the eyes of fontconfig:
% LCTYPE="en_US.UTF-8"
I'm not sure this is related to the non-appearing burned in subtitles, but I thought I should mention it.
Attachments (1)
Change History (10)
by , 12 years ago
Attachment: | ffmpeg-20130102-200734.log added |
---|
comment:2 by , 12 years ago
Replying to cehoyos:
Could you point us to sample input files?
There is a test.srt in the description.
Unfortunately, it seems we have no FFmpeg developer on Mac, so it's pretty hard to debug and have a clue about what is going on...
Some random guess: fontconfig or freetype doesn't find the Arial font, but fails silently...
Maybe checking if drawtext works could help us, eventually.
What I find strange is that libass seems to work (according to the working VLC), but doesn't here.
follow-up: 5 comment:3 by , 12 years ago
libass can be linked against different renderers, harfbuzz, fontconfig/freetype etc.
harfbuzz is the default now, and I am not sure the fontconfig stuff still works properly, I know MPlayer has a few hack in the code related to that, but I never had the motivation to review them again and pass them upstream.
However, the way it is supposed to work is that if a font isn't available it'll just use some substitute.
Something else that might be worth double-checking is that the srt file has Unix line breaks and not Mac ones, just in case that might break something.
comment:4 by , 12 years ago
When I compare the shared object files form the ffmpeg you are using to the one I build on OSX 10.7.4 ( see http://ffmpeg.org/trac/ffmpeg/wiki/MacOSXCompilationGuide ) I see a few missing libraries:
The build you are using:
ffmpeg version N-48456-gffc0bcc-tessus Copyright (c) 2000-2013 the FFmpeg developers built on Jan 2 2013 06:16:06 with llvm-gcc 4.2.1 (LLVM build 2336.1.00) configuration: --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm \ --extra-version=tessus --disable-shared --enable-static --disable-ffplay \ --disable-ffserver --enable-gpl --enable-pthreads --enable-postproc \ --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 \ --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib \ --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs \ --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc \ --enable-libvpx --enable-libgsm --enable-libopus --enable-fontconfig \ --enable-libfreetype --enable-libass --enable-filters --enable-runtime-cpudetect libavutil 52. 13.100 / 52. 13.100 libavcodec 54. 85.100 / 54. 85.100 libavformat 54. 59.100 / 54. 59.100 libavdevice 54. 3.102 / 54. 3.102 libavfilter 3. 30.102 / 3. 30.102 libswscale 2. 1.103 / 2. 1.103 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
and the corresponding the otool -L output:
~ $ otool -L Downloads/ffmpeg Downloads/ffmpeg: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.44.0) /System/Library/Frameworks/VideoDecodeAcceleration.framework/Versions/A/VideoDecodeAcceleration (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.6.3) /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.6.2)
My build:
ffmpeg version N-48425-g9e36d9e Copyright (c) 2000-2013 the FFmpeg developers built on Jan 3 2013 23:55:47 with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --enable-gpl --enable-version3 --enable-nonfree \ --enable-postproc --enable-libaacplus --enable-libass --enable-libcelt \ --enable-libfaac --enable-libfdk-aac --enable-libfreetype \ --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb \ --enable-libopenjpeg --enable-openssl --enable-libopus \ --enable-libschroedinger --enable-libspeex --enable-libtheora \ --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 \ --enable-libxvid --prefix=/usr/local libavutil 52. 13.100 / 52. 13.100 libavcodec 54. 85.101 / 54. 85.101 libavformat 54. 59.102 / 54. 59.102 libavdevice 54. 3.102 / 54. 3.102 libavfilter 3. 30.102 / 3. 30.102 libswscale 2. 1.103 / 2. 1.103 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
and the corresponding otool -L output:
~ $ otool -L /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg: /usr/X11/lib/libfreetype.6.dylib (compatibility version 14.0.0, current version 14.2.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5) /Library/Frameworks/Jackmp.framework/Versions/A/Jackmp (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 17.0.0) /usr/local/lib/libSDL-1.2.0.dylib (compatibility version 12.0.0, current version 12.4.0) /usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 44.0.0) /usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 44.0.0) /usr/local/lib/libvorbisenc.2.dylib (compatibility version 3.0.0, current version 3.9.0) /usr/local/lib/libvorbis.0.dylib (compatibility version 5.0.0, current version 5.6.0) /usr/local/lib/libogg.0.dylib (compatibility version 9.0.0, current version 9.0.0) /usr/local/lib/libvo-aacenc.0.dylib (compatibility version 1.0.0, current version 1.3.0) /usr/local/lib/libtheoraenc.1.dylib (compatibility version 3.0.0, current version 3.2.0) /usr/local/lib/libtheoradec.1.dylib (compatibility version 3.0.0, current version 3.4.0) /usr/local/lib/libspeex.1.5.0.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/local/lib/libschroedinger-1.0.0.dylib (compatibility version 12.0.0, current version 12.0.0) /usr/local/lib/libopus.0.dylib (compatibility version 3.0.0, current version 3.0.0) /usr/local/opt/openjpeg/lib/libopenjpeg.1.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/local/lib/libopencore-amrwb.0.dylib (compatibility version 1.0.0, current version 1.3.0) /usr/local/lib/libopencore-amrnb.0.dylib (compatibility version 1.0.0, current version 1.3.0) /opt/local/lib/libmp3lame.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/local/lib/libfaac.0.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/local/lib/libcelt0.2.dylib (compatibility version 3.0.0, current version 3.0.0) /usr/local/lib/libass.4.dylib (compatibility version 6.0.0, current version 6.0.0) /usr/local/lib/libaacplus.2.dylib (compatibility version 3.0.0, current version 3.2.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.21.0) /System/Library/Frameworks/VideoDecodeAcceleration.framework/Versions/A/VideoDecodeAcceleration (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.7.0) /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.7.0)
comment:5 by , 12 years ago
Replying to reimar:
[...]
Something else that might be worth double-checking is that the srt file has Unix line breaks and not Mac ones, just in case that might break something.
This should not change anything: the demuxer removes the trailing line breaks of an event, and the decoder should replace any CRLF or LF with the appropriate \N ASS code. Then the line is terminated with a proper CRLF in the rects[n]->ass (which is then passed to libass as a chunk in the subtitles filter). If it's not the case, that's a bug.
comment:6 by , 12 years ago
FYI the FFmpeg builds for OSX found at http://www.osxexperts.net/ffmpeg/ffmpegexperts.html are working fine with hardburning subtitles.
I use those builds all the time for encoding to .mov and hardburing .ass subs.
Though I only use -vf ass= and never tried the -vf subtitles filter.
comment:7 by , 12 years ago
I think the culprit is fontconfig. fontconfig/libass like to render nothing if no font is found. The following things can play into how fontconfig behaves:
- patches applied to it, and which version of fontconfig it's actually using (statically linked? system dynamic lib?)
- the fontconfig configuration (like fonts.conf)
- whether the config matches the actual fonts paths
- and probably the state of the fontconfig cache
comment:8 by , 12 years ago
Sorry for posting this ticket just before my holiday and only getting back so late!
Thanks for all the useful feedback, it helped me greatly on my search for a solution.
As it turns out, FFmpeg is working just fine. Fontconfig could not find a configuration file and when it did, that file did not contain any real font paths.
I have verified this with the ffmpegexperts OSX build and the latest snapshot build.
I did two things to get fontconfig working properly on my system:
- export FONTCONFIG_PATH=/opt/X11/lib/X11/fontconfig
- edit the /opt/X11/lib/X11/fontconfig/fonts.conf and added the directory "/Library/Fonts" to the font directory list
After this subtitles are burned in as expected, with both "-vf subtitles=..." and "-vf ass=...". Even if fonts are reported missing by fontconfig, a substitute is used and the subtitles are still being burned.
Please close the ticket, as the problem is indeed caused by fontconfig configuration as people suspected.
ffmpeg log report