Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

ffmpeg subtitles command not showing text, tried with .srt and .ass file. with and without -filter_complex same result

I have tried almost every suggestion on how to make subtitles work, in windows it works all the time, on android it does not. I see the required libraries in the output.

The command: ffmpeg -y -i "input.mp4" -vf subtitles=MySubtitle.srt "output.mp4"

I see this error message "W/mobile-ffmpeg: [graph 0 input from stream 0:0 @ 0x752e80aa90] sws_param option is deprecated and ignored" but I can't find help on it.

Below is the output of ffmpeg:

I/mobile-ffmpeg: Loading mobile-ffmpeg.
I/mobile-ffmpeg: Loaded mobile-ffmpeg-full-gpl-arm64-v8a-4.4-20200725.
D/mobile-ffmpeg: Callback thread started.
I/mobile-ffmpeg: ffmpeg version v4.4-dev-416
     Copyright (c) 2000-2020 the FFmpeg developers
I/mobile-ffmpeg:   built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn)
      configuration: --cross-prefix=aarch64-linux-android- --sysroot=/files/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8-a --cc=aarch64-linux-android24-clang --cxx=aarch64-linux-android24-clang++ --extra-libs='-L/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/cpu-features/lib -lndk_compat' --target-os=android --enable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libshine --enable-libspeex --enable-libwavpack --enable-libkvazaar --enable-libx264 --enable-gpl --enable-libxvid --enable-gpl --enable-libx265 --enable-gpl --enable-libvidstab --enable-gpl --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libaom --enable-libtwolame --disable-sdl2 --enable-libvo-amrwbenc --enable-zlib --enable-mediacodec
      libavutil      56. 55.100 / 56. 55.100
I/mobile-ffmpeg:   libavcodec     58. 96.100 / 58. 96.100
      libavformat    58. 48.100 / 58. 48.100
      libavdevice    58. 11.101 / 58. 11.101
I/mobile-ffmpeg:   libavfilter     7. 87.100 /  7. 87.100
      libswscale      5.  8.100 /  5.  8.100
I/mobile-ffmpeg:   libswresample   3.  8.100 /  3.  8.100
I/mobile-ffmpeg: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/data/user/0/com.example.MaiClips/files/Pc5//MYrender/finalrender.mp4':
      Metadata:
I/mobile-ffmpeg:     major_brand     : 
    isom
I/mobile-ffmpeg:     minor_version   : 
    512
I/mobile-ffmpeg:     compatible_brands: 
    isomiso2avc1mp41
I/mobile-ffmpeg:     encoder         : 
I/mobile-ffmpeg: Lavf58.48.100
      Duration: 
    00:40:11.94
I/mobile-ffmpeg: , start: 
    0.000000
    , bitrate: 
I/mobile-ffmpeg: 183 kb/s
        Stream #0:0
I/mobile-ffmpeg: (und)
    : Video: h264 (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 65 kb/s
    , 
I/mobile-ffmpeg: 15 fps, 
    15 tbr, 
I/mobile-ffmpeg: 15360 tbn, 
    30 tbc
I/mobile-ffmpeg:  (default)
        Metadata:
          handler_name    : 
I/mobile-ffmpeg: VideoHandler
        Stream #0:1
I/mobile-ffmpeg: (und)
    : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s
     (default)
I/mobile-ffmpeg:     Metadata:
          handler_name    : 
I/mobile-ffmpeg: SoundHandler
I/mobile-ffmpeg: Stream mapping:
      Stream #0:0 -> #0:0
     (h264 (native) -> h264 (libx264))
I/mobile-ffmpeg:   Stream #0:1 -> #0:1
I/mobile-ffmpeg:  (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
I/mobile-ffmpeg: [Parsed_subtitles_0 @ 0x752e7eb590] Shaper: FriBidi 1.0.9 (SIMPLE)
I/mobile-ffmpeg: [Parsed_subtitles_0 @ 0x752e7eb590] 
W/mobile-ffmpeg: [Parsed_subtitles_0 @ 0x752e7eb590] No usable fontconfig configuration file found, using fallback.
    [Parsed_subtitles_0 @ 0x752e7eb590] 
I/mobile-ffmpeg: [Parsed_subtitles_0 @ 0x752e7eb590] Using font provider fontconfig
    [Parsed_subtitles_0 @ 0x752e7eb590] 
W/mobile-ffmpeg: [graph 0 input from stream 0:0 @ 0x752e80aa90] sws_param option is deprecated and ignored
I/mobile-ffmpeg: [libx264 @ 0x759e882b60] using SAR=1/1
I/mobile-ffmpeg: [libx264 @ 0x759e882b60] using cpu capabilities: ARMv8 NEON
I/mobile-ffmpeg: [libx264 @ 0x759e882b60] profile High, level 2.2, 4:2:0, 8-bit
I/mobile-ffmpeg: [libx264 @ 0x759e882b60] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to '/data/user/0/com.example.MaiClips/files/Pc5//MYrender/MaiPodcast.mp4':
      Metadata:
        major_brand     : 
I/mobile-ffmpeg: isom
I/mobile-ffmpeg:     minor_version   : 
    512
        compatible_brands: 
I/mobile-ffmpeg: isomiso2avc1mp41
I/mobile-ffmpeg:     encoder         : 
    Lavf58.48.100
I/mobile-ffmpeg:     Stream #0:0
I/mobile-ffmpeg: (und)
    : Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1
I/mobile-ffmpeg: , 
    15 fps, 
    15360 tbn, 
    15 tbc
I/mobile-ffmpeg:  (default)
        Metadata:
          handler_name    : 
I/mobile-ffmpeg: VideoHandler
          encoder         : 
I/mobile-ffmpeg: Lavc58.96.100 libx264
        Side data:
I/mobile-ffmpeg:       
    cpb: 
    bitrate max/min/avg: 0/0/0 buffer size: 0 
    vbv_delay: N/A
I/mobile-ffmpeg:     Stream #0:1
    (und)
    : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
I/mobile-ffmpeg:  (default)
        Metadata:
          handler_name    : 
I/mobile-ffmpeg: SoundHandler
          encoder         : 
    Lavc58.96.100 aac
W/Choreographer: Frame time is 0.005891 ms in the future!  Check that graphics HAL is generating vsync timestamps using the correct timebase.
I/mobile-ffmpeg: frame=   50 fps=0.0 q=0.0 size=       0kB time=00:00:03.76 bitrate=   0.1kbits/s speed=7.51x    
I/mobile-ffmpeg: frame=  109 fps=108 q=27.0 size=       0kB time=00:00:07.73 bitrate=   0.0kbits/s speed=7.69x    
I/mobile-ffmpeg: frame=  159 fps=105 q=27.0 size=     256kB time=00:00:11.05 bitrate= 189.8kbits/s speed=7.33x    
I/mobile-ffmpeg: frame= 6317 fps=161 q=27.0 size=    9472kB time=00:07:00.55 bitrate= 184.5kbits/s speed=10.7x    
I/mobile-ffmpeg: frame= 6422 fps=162 q=27.0 size=    9472kB time=00:07:07.57 bitrate= 181.5kbits/s speed=10.8x    
I/mobile-ffmpeg: frame= 6518 fps=162 q=27.0 size=    9728kB time=00:07:14.02 bitrate= 183.6kbits/s speed=10.8x    
I/mobile-ffmpeg: frame= 6623 fps=163 q=27.0 size=    9728kB time=00:07:20.99 bitrate= 180.7kbits/s speed=10.8x    
I/mobile-ffmpeg: frame= 6717 fps=163 q=27.0 size=    9728kB time=00:07:27.26 bitrate= 178.2kbits/s speed=10.9x    
I/mobile-ffmpeg: frame= 6816 fps=164 q=27.0 size=    9984kB time=00:07:33.85 bitrate= 180.2kbits/s speed=10.9x    
I/mobile-ffmpeg: frame= 6918 fps=164 q=27.0 size=    9984kB time=00:07:40.66 bitrate= 177.5kbits/s speed=10.9x    
I/mobile-ffmpeg: frame=25322 fps=165 q=27.0 size=   37632kB time=00:28:08.57 bitrate= 182.6kbits/s speed=  11x    
I/mobile-ffmpeg: frame=25356 fps=165 q=27.0 size=   37888kB time=00:28:09.85 bitrate= 183.7kbits/s speed=  11x    
I/mobile-ffmpeg: frame=25387 fps=165 q=27.0 size=   37888kB time=00:28:11.94 bitrate= 183.4kbits/s speed=  11x    
I/mobile-ffmpeg: frame=25418 fps=164 q=27.0 size=   38144kB time=00:28:14.01 bitrate= 184.5kbits/s speed=10.9x    
I/mobile-ffmpeg: frame=25456 fps=164 q=27.0 size=   38400kB time=00:28:16.51 bitrate= 185.4kbits/s speed=10.9x    
I/mo
I/mobile-ffmpeg: frame=28946 fps=147 q=27.0 size=   51200kB time=00:40:07.25 bitrate= 174.2kbits/s speed=12.2x    
I/mobile-ffmpeg: frame=28956 fps=146 q=-1.0 Lsize=   53050kB time=00:40:11.92 bitrate= 180.2kbits/s speed=12.2x    
    video:14025kB audio:37969kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 
    2.030667%
I/mobile-ffmpeg: [libx264 @ 0x759e882b60] frame I:130   Avg QP:12.19  size: 33043
I/mobile-ffmpeg: [libx264 @ 0x759e882b60] frame P:7764  Avg QP:14.75  size:   871
    [libx264 @ 0x759e882b60] frame B:21062 Avg QP:19.97  size:   157
    [libx264 @ 0x759e882b60] consecutive B-frames:  2.4%  1.4%  1.3% 94.9%
    [libx264 @ 0x759e882b60] mb I  I16..4: 15.1% 70.4% 14.5%
    [libx264 @ 0x759e882b60] mb P  I16..4:  0.3%  1.1%  0.1%  P16..4:  6.3%  2.3%  1.2%  0.0%  0.0%    skip:88.7%
I/mobile-ffmpeg: [libx264 @ 0x759e882b60] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8:  3.2%  0.3%  0.0%  direct: 0.2%  skip:96.1%  L0:47.5% L1:47.1% BI: 5.4%
    [libx264 @ 0x759e882b60] 8x8 transform intra:72.9% inter:79.7%
    [libx264 @ 0x759e882b60] coded y,uvDC,uvAC intra: 64.6% 72.0% 41.8% inter: 1.2% 2.0% 0.1%
I/mobile-ffmpeg: [libx264 @ 0x759e882b60] i16 v,h,dc,p: 54% 13% 11% 21%
    [libx264 @ 0x759e882b60] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 15% 24%  4%  5%  7%  4%  7%  5%
    [libx264 @ 0x759e882b60] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 16% 13%  4%  7% 10%  5%  7%  3%
    [libx264 @ 0x759e882b60] i8c dc,h,v,p: 44% 20% 27%  9%
I/mobile-ffmpeg: [libx264 @ 0x759e882b60] Weighted P-Frames: Y:0.1% UV:0.0%
    [libx264 @ 0x759e882b60] ref P L0: 64.1% 13.4% 14.9%  7.6%  0.0%
    [libx264 @ 0x759e882b60] ref B L0: 83.6% 13.9%  2.5%
I/mobile-ffmpeg: [libx264 @ 0x759e882b60] ref B L1: 96.5%  3.5%
    [libx264 @ 0x759e882b60] kb/s:59.52
I/mobile-ffmpeg: [aac @ 0x759e885f20] Qavg: 299.818
I/mobile-ffmpeg: Command execution completed successfully.
D/addPodcastLayout::  Finished: finished
D/MediaPlayerNative: getMetadata
W/MediaPlayerNative: info/warning (3, 0)
question from:https://stackoverflow.com/questions/65853604/ffmpeg-subtitles-command-not-showing-text-tried-with-srt-and-ass-file-with-a

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I found several issues: I hope this notes helps others

  1. the format of hour:minute:second,miliseconds (note the comma for miliseconds, and colons for others. bug: I was putting my seconds into the minute slot,
  2. conversion error when time was rolling upwards would not roll the seconds into minutes
  3. check the last line of subtitle.srt make sure the last time entry is not zeros
  4. the time sequence must be continual, if any time stamp in between is smaller than previous, subtitle will not be displayed
  5. if you break the sentence in two lines in subtitle.srt, it will display it as a wrapped line.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...