[FFmpeg-user] Can't get ffpmeg to add subtitles to mp4 files

Richard DJE richard.dje at gmail.com
Fri Jan 3 15:04:50 EET 2020


All,


I started using FFmpeg to try adding subtitles to some of my mp3 files.
For that I turned those mp3 files into mp4 files by doing

*$ ffmpeg -i my.mp3 my.mp4*
-----------------------------------------------------------------------------------------------------

ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers

  built with Apple clang version 11.0.0 (clang-1100.0.33.16)

  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2 --enable-shared
--enable-pthreads --enable-version3 --enable-avresample --cc=clang
--host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk/Contents/Home/include
-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk/Contents/Home/include/darwin
-fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls
--enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame
--enable-libopus --enable-librubberband --enable-libsnappy
--enable-libtesseract --enable-libtheora --enable-libvidstab
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
--enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype
--enable-frei0r --enable-libass --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp
--enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack
--disable-indev=jack

  libavutil      56. 31.100 / 56. 31.100

  libavcodec     58. 54.100 / 58. 54.100

  libavformat    58. 29.100 / 58. 29.100

  libavdevice    58.  8.100 / 58.  8.100

  libavfilter     7. 57.100 /  7. 57.100

  libavresample   4.  0.  0 /  4.  0.  0

  libswscale      5.  5.100 /  5.  5.100

  libswresample   3.  5.100 /  3.  5.100

  libpostproc    55.  5.100 / 55.  5.100

[mp3 @ 0x7ff5e5000000] Estimating duration from bitrate, this may be
inaccurate

Input #0, mp3, from 'my.mp3':

  Duration: 00:00:08.75, start: 0.000000, bitrate: 127 kb/s

    Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 128 kb/s

Stream mapping:

  Stream #0:0 -> #0:0 (mp3 (mp3float) -> aac (native))

Press [q] to stop, [?] for help

Output #0, mp4, to 'my.mp4':

  Metadata:

    encoder         : Lavf58.29.100

    Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp,
69 kb/s

    Metadata:

      encoder         : Lavc58.54.100 aac

size=      78kB time=00:00:08.75 bitrate=  73.0kbits/s speed= 156x

video:0kB audio:76kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 2.987824%
-----------------------------------------------------------------------------------------------------

I then executed the following in order to add the subtitles

*$ ffmpeg -report -i my.mp4 -vf subtitles=my.srt my_sub.mp4*
-----------------------------------------------------------------------------------------------------

ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers

  built with Apple clang version 11.0.0 (clang-1100.0.33.16)

  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2 --enable-shared
--enable-pthreads --enable-version3 --enable-avresample --cc=clang
--host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk/Contents/Home/include
-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk/Contents/Home/include/darwin
-fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls
--enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame
--enable-libopus --enable-librubberband --enable-libsnappy
--enable-libtesseract --enable-libtheora --enable-libvidstab
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
--enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype
--enable-frei0r --enable-libass --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp
--enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack
--disable-indev=jack

  libavutil      56. 31.100 / 56. 31.100

  libavcodec     58. 54.100 / 58. 54.100

  libavformat    58. 29.100 / 58. 29.100

  libavdevice    58.  8.100 / 58.  8.100

  libavfilter     7. 57.100 /  7. 57.100

  libavresample   4.  0.  0 /  4.  0.  0

  libswscale      5.  5.100 /  5.  5.100

  libswresample   3.  5.100 /  3.  5.100

  libpostproc    55.  5.100 / 55.  5.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'my.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2mp41

    encoder         : Lavf58.29.100

  Duration: 00:00:08.78, start: 0.000000, bitrate: 72 kb/s

    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono,
fltp, 70 kb/s (default)

    Metadata:

      handler_name    : SoundHandler

Stream mapping:

  Stream #0:0 -> #0:0 (aac (native) -> aac (native))

Press [q] to stop, [?] for help

Output #0, mp4, to 'my_sub.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2mp41

    encoder         : Lavf58.29.100

    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono,
fltp, 69 kb/s (default)

    Metadata:

      handler_name    : SoundHandler

      encoder         : Lavc58.54.100 aac

size=      78kB time=00:00:08.75 bitrate=  73.2kbits/s speed= 174x

video:0kB audio:76kB subtitle:*0*kB other streams:0kB global headers:0kB
muxing overhead: 2.971010%

[aac @ 0x7ffbeb003800] Qavg: 761.199
-----------------------------------------------------------------------------------------------------

I attached the log of the above command as ffmpeg-20200103-134542.log.

The problem I am seeing is that no subtitle is displayed, at all.
This seems to be confirmed with subtitle:*0*kB.

I also tried different subtitles' commands like

*$ ffmpeg -i my.pm4 -i my.srt -c copy -c:s mov_text my_sub.mp4*

But I end up with the exact same issue.

I Googled a lot yesterday, read a lot of different ways to add subtitles
using FFmpeg but none of them worked.

I am running on a macOS Catalina Version 10.15.2
*$ uname -a*

Darwin Richards-MacBook-Pro.local 19.2.0 Darwin Kernel Version 19.2.0: Sat
Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 x86_64



I attached the following files
- *my.mp3*
-* my.srt*

This file only contains two subtitle entries



* Is the issue due to my srt file ?
* Did I use the right options for creating the mp4 from the mp3
* Did I use the right set of options for adding the subtitles ?


Thank you in advance for any help you might provide.

BR,
-Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-20200103-134542.log
Type: application/octet-stream
Size: 6442 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20200103/cd279131/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: my.mp3
Type: audio/mp3
Size: 140015 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20200103/cd279131/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: my.srt
Type: application/octet-stream
Size: 71 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20200103/cd279131/attachment-0001.obj>


More information about the ffmpeg-user mailing list