Opened 9 years ago

Closed 9 years ago

#4744 closed defect (fixed)

ffmpeg does not scale subtitles

Reported by: Carl Eugen Hoyos Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: sub
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

The samples from ticket #679 show the subtitles correctly with FFplay, but they are no automatically scaled with ffmpeg.

$ ffmpeg -canvas_size 720x576 -i subtitles.ts -filter_complex [0:0][0:3]overlay -qscale 2 out.avi
ffmpeg version N-74140-g6c87b86 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libzvbi
  libavutil      54. 29.100 / 54. 29.100
  libavcodec     56. 56.101 / 56. 56.101
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 30.100 /  5. 30.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[mpeg2video @ 0x3613fc0] Invalid frame dimensions 0x0.
    Last message repeated 10 times
[NULL @ 0x3618a80] start time for stream 2 is not set in estimate_timings_from_pts
[mpegts @ 0x35f0360] PES packet size mismatch
[mpegts @ 0x35f0360] Could not find codec parameters for stream 2 (Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels, s16p): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x35f0360] Could not find codec parameters for stream 4 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x35f0360] Could not find codec parameters for stream 5 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x35f0360] Could not find codec parameters for stream 6 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x35f0360] Could not find codec parameters for stream 7 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'subtitles.ts':
  Duration: 00:00:09.21, start: 11318.457333, bitrate: 2223 kb/s
  Program 8270
    Metadata:
      service_name    : ITV1
      service_provider: ITV
  Program 8325
    Metadata:
      service_name    : ITV2
      service_provider: ITV
  Program 8634
    Metadata:
      service_name    : Rabbit
      service_provider: Teletext Limited
  Program 8384
    Metadata:
      service_name    : Channel 4
      service_provider: Channel 4 TV
  Program 8448
    Metadata:
      service_name    : E4
      service_provider: Channel 4 TV
  Program 8442
    Metadata:
      service_name    : More 4
      service_provider: Channel 4 TV
    Stream #0:0[0x24e]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 544x576 [SAR 32:17 DAR 16:9], max. 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x24f](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:2[0x250](eng): Audio: mp3 ([4][0][0][0] / 0x0004), 0 channels, s16p (visual impaired)
    Stream #0:3[0x251](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:4[0x84f]: Unknown: none ([11][0][0][0] / 0x000B)
    Stream #0:5[0x911]: Unknown: none ([11][0][0][0] / 0x000B)
    Stream #0:6[0x912]: Unknown: none ([11][0][0][0] / 0x000B)
    Stream #0:7[0xbbb]: Unknown: none ([11][0][0][0] / 0x000B)
  Program 8452
    Metadata:
      service_name    : Channel 4+1
      service_provider: Channel 4 TV
  Program 8577
    Metadata:
      service_name    : Gay Rabbit
      service_provider: Teletext Limited
  Program 8500
    Metadata:
      service_name    : Channel 5
      service_provider: five
  Program 8370
    Metadata:
      service_name    : ITV1 +1
      service_provider: ITV
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 544x576 [SAR 32:17 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc56.56.101 mpeg4
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      encoder         : Lavc56.56.101 ac3
Stream mapping:
  Stream #0:0 (mpeg2video) -> overlay:main (graph 0)
  Stream #0:3 (dvbsub) -> overlay:overlay (graph 0)
  overlay (graph 0) -> Stream #0:0 (mpeg4)
  Stream #0:1 -> #0:1 (mp2 (native) -> ac3 (native))
Press [q] to stop, [?] for help
[mpegts @ 0x35f0360] PES packet size mismatche=00:00:07.88 bitrate=3515.2kbits/s
[mpeg2video @ 0x365a080] ac-tex damaged at 11 25
[mpeg2video @ 0x365a080] Warning MVs not available
[mpeg2video @ 0x365a080] concealing 374 DC, 374 AC, 374 MV errors in I frame
Past duration 0.743889 too large
frame=  198 fps=0.0 q=2.0 Lsize=    4318kB time=00:00:09.24 bitrate=3828.2kbits/s
video:4100kB audio:196kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.498193%
$ ffmpeg -i BDAV\ recorded\ video\ sample.ts -filter_complex [0:0][0:3]overlay -qscale 2 out.avi
ffmpeg version N-74140-g6c87b86 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libzvbi
  libavutil      54. 29.100 / 54. 29.100
  libavcodec     56. 56.101 / 56. 56.101
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 30.100 /  5. 30.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[h264 @ 0x1c637a0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] no frame!

...

[h264 @ 0x1c637a0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] non-existing SPS 0 referenced in buffering period
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] non-existing PPS 0 referenced
[h264 @ 0x1c637a0] decode_slice_header error
[h264 @ 0x1c637a0] no frame!
[mpegts @ 0x1c5d360] Could not find codec parameters for stream 4 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'BDAV recorded video sample.ts':
  Duration: 00:00:44.83, start: 47323.752122, bitrate: 4616 kb/s
  Program 82
    Metadata:
      service_name    : J2
      service_provider: TVB
    Stream #0:0[0x335]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x336]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:2[0x337]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:3[0x339](CHI): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:4[0x3e9]: Unknown: none ([11][0][0][0] / 0x000B)
  Program 83
    Metadata:
      service_name    : iNews
      service_provider: TVB
  Program 85
    Metadata:
      service_name    : High Definition Jade
      service_provider: TVB
Please use -q:a or -q:v, -qscale is ambiguous
[mpegts @ 0x1c5d360] sub2video: using 1920x1080 canvas
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc56.56.101 mpeg4
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      encoder         : Lavc56.56.101 ac3
Stream mapping:
  Stream #0:0 (h264) -> overlay:main (graph 0)
  Stream #0:3 (dvbsub) -> overlay:overlay (graph 0)
  overlay (graph 0) -> Stream #0:0 (mpeg4)
  Stream #0:1 -> #0:1 (ac3 (native) -> ac3 (native))
Press [q] to stop, [?] for help
[h264 @ 0x2dc88c0] error while decoding MB 38 4, bytestream -8rate=10554.1kbits/s
[h264 @ 0x2dc88c0] concealing 7691 DC, 7691 AC, 7691 MV errors in P frame
Past duration 0.760826 too large  56590kB time=00:00:44.68 bitrate=10375.6kbits/s
frame= 1089 fps= 68 q=2.0 Lsize=   57117kB time=00:00:44.88 bitrate=10425.6kbits/s
video:56021kB audio:1027kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.120315%

Change History (2)

comment:1 by Faravid, 9 years ago

Same problem here, DVB-subtitle layer does not scale.

Sample file available here: https://www.dropbox.com/s/4voq6p56bv2l4to/sample.ts?dl=0
File is a clipped DVBLink recorded TVshow, a transponder file.

Console output:

BTW, that "too large" error and crash did not happen on a build I downloaded 3 days ago, it is not part of this reported problem so lets just ignore it for now.

C:\ffmpeg\bin>ffmpeg -i "sample.ts" -filter_complex "[0:s:0]scale=width=1920:height=1080[sub];[0:v][sub]overlay" "sampleconv.mp4"
ffmpeg version N-74202-g336822e Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 29.100 / 54. 29.100
  libavcodec     56. 56.101 / 56. 56.101
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 30.100 /  5. 30.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246736897, dts=2246737142, size=4963
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246736897, dts=2246737142, size=4733
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246751489, dts=2246751542, size=3622
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246751489, dts=2246751542, size=3497
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246765825, dts=2246765942, size=6423
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246765825, dts=2246765942, size=5918
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246780161, dts=2246780342, size=4487
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246780161, dts=2246780342, size=4281
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246809089, dts=2246809142, size=5826
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246809089, dts=2246809142, size=6095
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246823425, dts=2246823542, size=4849
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246823425, dts=2246823542, size=4344
Input #0, mpegts, from 'sample.ts':
  Duration: 00:00:17.42, start: 24961.862222, bitrate: 8930 kb/s
  Program 1066 
    Metadata:
      service_name    : ?
      service_provider: ?
    Stream #0:0[0x370](eng): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 448 kb/s
    Stream #0:1[0x373](dut): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 192 kb/s (visual impaired)
    Stream #0:2[0x101f](fin): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:3[0x13f0](fin): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:4[0x13c]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
[mpegts @ 0000000003c667e0] sub2video: using 1920x1080 canvas
[libx264 @ 000000000751a400] using SAR=1/1
[libx264 @ 000000000751a400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 000000000751a400] profile High, level 4.0
[libx264 @ 000000000751a400] 264 - core 146 r2538 121396c - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=6 lookahead_threads=1 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=25 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 'sampleconv.mp4':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc56.56.101 libx264
    Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128 kb/s
    Metadata:
      encoder         : Lavc56.56.101 libvo_aacenc
Stream mapping:
  Stream #0:2 (dvbsub) -> scale (graph 0)
  Stream #0:4 (h264) -> overlay:main (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #0:0 -> #0:1 (ac3 (native) -> aac (libvo_aacenc))
Press [q] to stop, [?] for help
[h264 @ 000000000751c0e0] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246736897, dts=2246737142, size=4963
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246736897, dts=2246737142, size=4733
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246751489, dts=2246751542, size=3622
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246751489, dts=2246751542, size=3497
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246765825, dts=2246765942, size=6423
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246765825, dts=2246765942, size=5918
frame=   31 fps=0.0 q=0.0 size=       0kB time=00:00:00.47 bitrate=   0.8kbits/s dup=1 drop=0    [mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246780161, dts=2246780342, size=4487
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246780161, dts=2246780342, size=4281
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246809089, dts=2246809142, size=5826
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246809089, dts=2246809142, size=6095
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246823425, dts=2246823542, size=4849
[mpegts @ 0000000003c667e0] Invalid timestamps stream=4, pts=2246823425, dts=2246823542, size=4344
Past duration 0.933601 too large
frame=  414 fps= 23 q=-1.0 Lsize=    5130kB time=00:00:16.52 bitrate=2543.5kbits/s dup=1 drop=0    
video:4857kB audio:259kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.266437%
[libx264 @ 000000000751a400] frame I:5     Avg QP:20.24  size:130465
[libx264 @ 000000000751a400] frame P:123   Avg QP:22.49  size: 22395
[libx264 @ 000000000751a400] frame B:286   Avg QP:24.55  size:  5476
[libx264 @ 000000000751a400] consecutive B-frames:  1.7% 15.0% 10.9% 72.5%
[libx264 @ 000000000751a400] mb I  I16..4: 14.6% 67.6% 17.8%
[libx264 @ 000000000751a400] mb P  I16..4:  1.1%  2.7%  0.2%  P16..4: 42.5%  9.0%  6.5%  0.0%  0.0%    skip:38.0%
[libx264 @ 000000000751a400] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 39.0%  0.8%  0.1%  direct: 0.4%  skip:59.5%  L0:41.4% L1:57.4% BI: 1.2%
[libx264 @ 000000000751a400] 8x8 transform intra:66.7% inter:84.1%
[libx264 @ 000000000751a400] coded y,uvDC,uvAC intra: 54.8% 43.7% 10.6% inter: 8.6% 7.6% 0.0%
[libx264 @ 000000000751a400] i16 v,h,dc,p: 31% 25% 10% 33%
[libx264 @ 000000000751a400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 17% 30%  4%  6%  6%  6%  5%  5%
[libx264 @ 000000000751a400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 23% 12%  4%  8%  7%  6%  4%  5%
[libx264 @ 000000000751a400] i8c dc,h,v,p: 55% 19% 23%  3%
[libx264 @ 000000000751a400] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000000751a400] ref P L0: 59.7% 11.1% 21.2%  8.0%
[libx264 @ 000000000751a400] ref B L0: 83.8% 13.4%  2.8%
[libx264 @ 000000000751a400] ref B L1: 92.1%  7.9%
[libx264 @ 000000000751a400] kb/s:2402.43

comment:2 by Michael Niedermayer, 9 years ago

Reproduced by developer: set
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.