Discussion:
[FFmpeg-user] How do I add subtitles to mp4 files?
Alexander Kulyakhtin
2013-03-19 13:45:14 UTC
Permalink
Do you know if it is possible to add subtitles to mp4 file using FFMPEG?

Currently I'm trying

ffmpeg -i input.mp4 -i input.srt output.mp4

But I can't see any subtitles in output .mp4

Whereas if I specify output .mkv then I do see subtitiles. However, I need
mp4 not mkv.

Thanks in advance
Carl Eugen Hoyos
2013-03-19 15:14:24 UTC
Permalink
Post by Alexander Kulyakhtin
Currently I'm trying
ffmpeg -i input.mp4 -i input.srt output.mp4
You have to specify -scodec mov_text but note
that the subtitles will not be playable with
all players, FFmpeg does not (yet) support
setting all properties for mov_text correctly.

Carl Eugen
Alexander Kulyakhtin
2013-03-19 16:53:46 UTC
Permalink
It helped with the reference ffmpeg build. However it looks like my ffmpeg
is built without the mov_text.

Do you know which configure option enables the mov_text encoder?

Thanks in advance,
Post by Carl Eugen Hoyos
Post by Alexander Kulyakhtin
Currently I'm trying
ffmpeg -i input.mp4 -i input.srt output.mp4
You have to specify -scodec mov_text but note
that the subtitles will not be playable with
all players, FFmpeg does not (yet) support
setting all properties for mov_text correctly.
Carl Eugen
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Carl Eugen Hoyos
2013-03-19 17:53:41 UTC
Permalink
Post by Alexander Kulyakhtin
However it looks like my ffmpeg
is built without the mov_text.
Please provide (your command line and) complete, uncut
console output.
Post by Alexander Kulyakhtin
Do you know which configure option enables the mov_text encoder?
It is enabled by default.

Please do not top-post here, Carl Eugen
Alexander Kulyakhtin
2013-03-20 09:04:52 UTC
Permalink
Please provide your command line and complete, uncut console output.
ffmpeg -i myvideo.mp4 -i mysrt.srt -scodec mov_text myout.mp4

This works with ffmpeg.exe on windows combining input video and subtitiles
in the output video.

However, I'm using an ffmpeg binary build for Android and the same gives
me output as follows:
I can rebuild ffmpeg for Android changing any options but I don't know
which options should be changed.


ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
built on Mar 19 2013 17:07:16 with gcc 4.6 20120106 (prerelease)
configuration:
--arch=arm
--cpu=cortex-a8
--target-os=linux
--enable-runtime-cpudetect
--prefix=/data/data/info.guardianproject.ffmpeg/app_opt
--enable-pic
--disable-shared
--enable-static
--cross-prefix=/home/me/android-ndk-r8d//toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
--sysroot=/home/me/android-ndk-r8d//platforms/android-3/arch-arm
--extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon'
--extra-ldflags=-L../x264
--enable-version3
--enable-gpl
--disable-doc
--enable-yasm
--enable-decoders
--enable-encoders
--enable-muxers
--enable-demuxers
--enable-parsers
--enable-protocols
--enable-filters
--enable-avresample
--enable-libfreetype
--disable-indevs
--enable-indev=lavfi
--disable-outdevs
--enable-hwaccels
--enable-ffmpeg -
--disable-ffplay
--disable-ffprobe
--disable-ffserver
--disable-network
--enable-libx264
--enable-zlib

libavutil 51. 54.100 / 51. 54.100
libavcodec 54. 23.100 / 54. 23.100
libavformat 54. 6.100 / 54. 6.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 2. 77.100 / 2. 77.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/storage/sdcard0/LegalRecorder/20130320_125607.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2013-03-20 08:56:17
Duration: 00:00:09.00, start: 0.000000, bitrate: 365 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p,
176x144, 362 kb/s, 28.20 fps, 29.67 tbr, 90k tbn, 180k tbc
Metadata:
rotate : 90
creation_time : 2013-03-20 08:56:17
handler_name : VideoHandle
[srt @ 0xedc060] Estimating duration from bitrate, this may be inaccurate
nput #1, srt, from '/storage/sdcard0/LegalRecorder/20130320_125607.srt':
Duration: N/A, bitrate: N/A
Stream #1:0: Subtitle: srt
*Unknown encoder 'mov_text'*

Ffmpeg returns 1 then (not 0 as on success).

Is there anything wrong with the build options or anywhere?

Thanks in advance
Alex
Paul B Mahol
2013-03-20 09:55:26 UTC
Permalink
Post by Alexander Kulyakhtin
Please provide your command line and complete, uncut console output.
ffmpeg -i myvideo.mp4 -i mysrt.srt -scodec mov_text myout.mp4
This works with ffmpeg.exe on windows combining input video and subtitiles
in the output video.
However, I'm using an ffmpeg binary build for Android and the same gives
I can rebuild ffmpeg for Android changing any options but I don't know
which options should be changed.
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
built on Mar 19 2013 17:07:16 with gcc 4.6 20120106 (prerelease)
Too old.
Post by Alexander Kulyakhtin
--arch=arm
--cpu=cortex-a8
--target-os=linux
--enable-runtime-cpudetect
--prefix=/data/data/info.guardianproject.ffmpeg/app_opt
--enable-pic
--disable-shared
--enable-static
--cross-prefix=/home/me/android-ndk-r8d//toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
--sysroot=/home/me/android-ndk-r8d//platforms/android-3/arch-arm
--extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon'
--extra-ldflags=-L../x264
--enable-version3
--enable-gpl
--disable-doc
--enable-yasm
--enable-decoders
--enable-encoders
--enable-muxers
--enable-demuxers
--enable-parsers
--enable-protocols
--enable-filters
--enable-avresample
--enable-libfreetype
--disable-indevs
--enable-indev=lavfi
--disable-outdevs
--enable-hwaccels
--enable-ffmpeg -
--disable-ffplay
--disable-ffprobe
--disable-ffserver
--disable-network
--enable-libx264
--enable-zlib
libavutil 51. 54.100 / 51. 54.100
libavcodec 54. 23.100 / 54. 23.100
libavformat 54. 6.100 / 54. 6.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 2. 77.100 / 2. 77.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2013-03-20 08:56:17
Duration: 00:00:09.00, start: 0.000000, bitrate: 365 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p,
176x144, 362 kb/s, 28.20 fps, 29.67 tbr, 90k tbn, 180k tbc
rotate : 90
creation_time : 2013-03-20 08:56:17
handler_name : VideoHandle
Duration: N/A, bitrate: N/A
Stream #1:0: Subtitle: srt
*Unknown encoder 'mov_text'*
Ffmpeg returns 1 then (not 0 as on success).
Is there anything wrong with the build options or anywhere?
Thanks in advance
Alex
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Carl Eugen Hoyos
2013-03-21 00:15:22 UTC
Permalink
Post by Alexander Kulyakhtin
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
(As said, this is too old.)
Post by Alexander Kulyakhtin
built on Mar 19 2013 17:07:16 with gcc 4.6 20120106 (prerelease)
--disable-shared
--enable-static
--enable-yasm
--enable-decoders
--enable-encoders
--enable-muxers
--enable-demuxers
--enable-parsers
--enable-protocols
--enable-filters
--enable-hwaccels
--enable-ffmpeg
--enable-zlib
The following option makes no difference concerning the
compilation, I wonder if you use it intentionally
Post by Alexander Kulyakhtin
--enable-version3
Carl Eugen

Continue reading on narkive:
Loading...