Setting font size of Closed Captions on iPhone using ffmpeg or mencoder
Posted
by
forthrin
on Super User
See other posts from Super User
or by forthrin
Published on 2012-12-15T08:47:31Z
Indexed on
2012/12/15
11:08 UTC
Read the original article
Hit count: 307
Does anyone know how to either:
- Make
ffmpeg
set subtitle font size in the output video file - Make
mencoder
produce an iPhone-compatible video file (with subtitles)
I finally found out how to get Closed Captions video on iPhone, with mkv
and srt
files as source material. The secret was using the mov_text
subtitle codec in ffmpeg
(and turning on Closed Captions in the iPhone settings of course):
ffmpeg -y -i in.mkv -i in.srt -map 0:0 -map 0:1 -map 1:0 -vcodec copy -acodec aac -ab 256k -scodec mov_text -strict -2 -metadata title="Title" -metadata:s:s:0 language=eng out.mp4
However, the font size appears very small on the iPhone, and I can't find out how to set it with ffmpeg
(the iPhone has no option for this).
I found out that mencoder
has a -subfont-text-scale
option, but I don't have a lot of experience with this program. The following, my best attempt so far, produces an output file which is not playable on the iPhone.
sudo port install mplayer +mencoder_extras +osd
mencoder in.mkv -sub in.srt -o out.mp4 -ovc copy -oac faac -faacopts br=256:mpeg=4:object=2 -channels 2 -srate 48000 -subfont-text-scale 10 -of lavf -lavfopts format=mp4
PS! As requested, here is the output from mencoder:
192 audio & 400 video codecs
success: format: 0 data: 0x0 - 0xb64b9d2f
libavformat version 54.6.101 (internal)
libavformat file format detected.
[matroska,webm @ 0x1015c9a50]Unknown entry 0x80
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (ac3), -aid 0, -alang eng
VIDEO: [H264] 1280x544 0bpp 49.894 fps 0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:44 fourcc:0x34363248 size:1280x544 fps:49.894 ftime:=0.0200
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 54.23.100 (internal)
AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
** MUXER_LAVF *****************************************************************
REMEMBER: MEncoder's libavformat muxing is presently broken and can generate
INCORRECT files in the presence of B-frames. Moreover, due to bugs MPlayer
will play these INCORRECT files as if nothing were wrong!
*******************************************************************************
OK, exit.
videocodec: framecopy (1280x544 0bpp fourcc=34363248)
VIDEO CODEC ID: 28
AUDIO CODEC ID: 15002, TAG: 0
Writing header...
[mp4 @ 0x1015c9a50]Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 0x1015c9a50]Codec for stream 1 does not use global headers but container format requires global headers
Then the following repeats itself for every frame:
Pos: 0.0s 1f ( 2%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
[mp4 @ 0x1015c9a50]malformated aac bitstream, use -absf aac_adtstoasc
Error while writing frame.
I recognize -absf aac_adtstoasc
as an ffmpeg
option (does mencoder
spawn ffmpeg
?), but I don't know how to pass this option on (my hunch is this is not even the origin of the problem).
© Super User or respective owner