[FFmpeg-user] ffmpeg livestreaming with subtitles

JamesW2015 jf_weng at yahoo.com
Mon May 18 17:24:21 CEST 2015


Hi, 
I am a new ffmpeg user. I like it very much. I got a subtitle livestreaming
problem though. 

Basically, I like to livestream a customized subtitles together with
audio/video mp4 file. The subtitle track has to be a separate one (cannot be
hardcoded or burned into the video data. I know how to burn but I don't want
that as the user at the client side may change the subtitles). I have
recently asked a question on  ffmpeg livestreaming with subtitles
<http://ffmpeg.gusari.org/viewtopic.php?f=11&t=2115>  in ffmpeg developer
forum but was suggested that I asked the question on how to livestream
subtitles with ffmpeg here. 

Please help. 

Here is the current status,  
* Already added subtitles to "india_sub_srt.mp4" using ffmpeg successfully.
Using a vlc player to play the file, I can see the newly added subtitles.

* I am using an octoshape sever. The server set up was fine. If I use "-f
flv" instead of "-f mpegts" as the output container (see below), I can
stream successfully. However, "flv" does not support subtitle livestream. I
also tried "mp4", "mov" as an output format but got an error message saying
those are not seekable formats.

* Followed a couple of suggestions I got from the aforementioned post and
was able to see ffmpeg processing audo, video, and even subtitle for
streaming but there was a conversion failure. I wonder: does it mean the
current ffmpeg does not support or I need to use some other format?

Please see below for my screen print-outs.

Command:
ffmpeg -re -i india_sub_srt.mp4 -c:v libx264 -preset fast -maxrate 500k
-bufsize 4000k -pix_fmt yuv420p -g 50 -c:a copy -c:s copy -f mpegts
rtmp://localhost/live/livestream

Screen print-out:
ffmpeg version N-71481-g1c37848 Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-av                                                          isynth
--enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab                                                         
le-iconv --enable-libass --enable-libbluray --enable-libbs2b
--enable-libcaca --                                                         
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm
--enable-l                                                          ibilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab                                                         
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp
--en                                                         
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora
--ena                                                         
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc
--enable-libvo-amrwbenc                                                          
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
--enabl                                                          e-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena                                                         
ble-decklink --enable-zlib
  libavutil      54. 22.101 / 54. 22.101
  libavcodec     56. 34.100 / 56. 34.100
  libavformat    56. 30.100 / 56. 30.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 14.100 /  5. 14.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'india_sub_srt.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.30.100
  Duration: 00:04:59.86, start: 0.000000, bitrate: 309 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yu                                                         
v420p(tv, bt709), 320x180, 209 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc
(default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
flt                                                          p, 95 kb/s
(default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(und): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
(default)
    Metadata:
      handler_name    : SubtitleHandler
[libx264 @ 040cbe60] using cpu capabilities: MMX2 SSE2Fast LZCNT
[libx264 @ 040cbe60] profile High, level 2.1
Output #0, mpegts, to 'rtmp://localhost/live/livestream':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.30.100
    Stream #0:0(und): Video: h264 (libx264), yuv420p, 320x180, q=-1--1, max.
500                                                           kb/s, 25 fps,
90k tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc56.34.100 libx264
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, 95
kb/s                                                           (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(und): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
(default)
    Metadata:
      handler_name    : SubtitleHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame=   12 fps=0.0 q=0.0 size=       0kB time=00:00:00.55 bitrate=  
0.0kbits/s                                                          frame=  
25 fps= 25 q=0.0 size=       0kB time=00:00:01.04 bitrate=   0.0kbits/s                                                         
frame=   37 fps= 24 q=0.0 size=       0kB time=00:00:01.57 bitrate=  
0.0kbits/s                                                          frame=  
50 fps= 25 q=28.0 size=      11kB time=00:00:02.06 bitrate=  42.9kbits/                                                         
frame=   63 fps= 25 q=28.0 size=      22kB time=00:00:02.56 bitrate= 
70.5kbits/                                                          WriteN,
RTMP send error 10053 (129 bytes)B time=00:02:18.53 bitrate= 242.1kbits/s
WriteN, RTMP send error 10053 (45 bytes)
WriteN, RTMP send error 10038 (42 bytes)
av_interleaved_write_frame(): Operation not permitted
frame= 3467 fps= 25 q=-1.0 Lsize=    4103kB time=00:02:18.77 bitrate=
242.2kbits/s
video:1942kB audio:1627kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 14.971242%
[libx264 @ 040cbe60] frame I:86    Avg QP:17.47  size:  5505
[libx264 @ 040cbe60] frame P:1434  Avg QP:21.71  size:   814
[libx264 @ 040cbe60] frame B:1947  Avg QP:23.42  size:   178
[libx264 @ 040cbe60] consecutive B-frames: 21.3%  8.8%  8.2% 61.7%
[libx264 @ 040cbe60] mb I  I16..4: 12.0% 49.7% 38.3%
[libx264 @ 040cbe60] mb P  I16..4:  0.8%  1.8%  0.9%  P16..4: 37.5% 12.7% 
5.5%  0.0%  0.0%    skip:40.8%
[libx264 @ 040cbe60] mb B  I16..4:  0.5%  0.5%  0.1%  B16..8: 17.4%  3.4% 
0.1%  direct: 4.3%  skip:73.6%  L0:46.0% L1:44.8% BI: 9.2%
[libx264 @ 040cbe60] 8x8 transform intra:49.2% inter:60.0%
[libx264 @ 040cbe60] coded y,uvDC,uvAC intra: 53.3% 67.6% 36.2% inter: 7.9%
12.5% 0.3%
[libx264 @ 040cbe60] i16 v,h,dc,p: 40% 24% 20% 16%
[libx264 @ 040cbe60] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 15% 27%  3%  5%  5% 
5%  5%  5%
[libx264 @ 040cbe60] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 14% 13%  4%  6%  6% 
6%  4%  4%
[libx264 @ 040cbe60] i8c dc,h,v,p: 50% 19% 25%  6%
[libx264 @ 040cbe60] Weighted P-Frames: Y:1.3% UV:0.5%
[libx264 @ 040cbe60] ref P L0: 78.4% 21.6%
[libx264 @ 040cbe60] ref B L0: 85.1% 14.9%
[libx264 @ 040cbe60] ref B L1: 95.4%  4.6%
[libx264 @ 040cbe60] kb/s:114.71
Conversion failed!





--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/ffmpeg-livestreaming-with-subtitles-tp4670507.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list