Opened 3 months ago

Closed 2 months ago

#7239 closed defect (fixed)

No error for attempted conversion from text subtitles to bitmap subtitles.

Reported by: smallishzulu Owned by:
Priority: minor Component: ffmpeg
Version: git-master Keywords: sub
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hi,

I try to encode srt to dvbsub by below command:

/opt/ffmpeg/bin/ffmpeg -canvas_size 1920x1080 -i /home/me/Arrow_S04_B04.MXF -i /home/me/Arrow_Test_S04_Ep04.srt -map 0:0 -s 1920x1080 -aspect 16:9 -vcodec libx264 -vb 2000k -bufsize 2000k -maxrate 2000k -map 0:1 -acodec aac -ab 128k -map 1:0 -scodec dvbsub -f mpegts /home/me/output.ts

The subtitles do not appear in mpv, in a DVB STB and in VLC.
I checked the output that there is dvbsub packets in mpegts. I checked in details with a dvb subtitle editor that it seems dvbsub do not include widthxheight info. But subtitles do exists.

I also confirmed wxh is missing by ffmpeg:

/opt/ffmpeg/bin/ffmpeg -i /home/me/output.ts -vcodec copy -acodec copy -scodec dvbsub -y -f mpegts /dev/null

[dvbsub @ 0x7286c0] [IMGUTILS @ 0x7ffee8adda00] Picture size 0x0 is invalid

I think canvas_size do not work for dvbsub right now.

Full FFmpeg Log 1:

ffmpeg version N-91062-gf995aa8 Copyright (c) 2000-2018 the FFmpeg developers

built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --prefix=/opt/ffmpeg --enable-nonfree --enable-gpl --extra-cflags='-I/opt/ffmpeg/include -I/usr/local/include -I/usr/local/cuda/include -I/opt/ndi/sdk/include' --extra-ldflags='-L/opt/ffmpeg/lib -L/usr/local/cuda/lib64 -L/opt/ndi/sdk/lib' --bindir=/opt/ffmpeg/bin --extra-libs=-ldl --enable-libx264 --enable-libx265 --enable-nonfree --enable-gpl --enable-nvenc --enable-libzvbi --enable-libfdk-aac --enable-libzimg --enable-libzmq --enable-libfreetype --enable-static --enable-shared --enable-hardcoded-tables --enable-vdpau --enable-cuda --enable-cuvid --enable-libvpx --enable-libmp3lame --enable-libndi_newtek --enable-openssl --enable-ffnvcodec --enable-libfontconfig --enable-libfribidi --enable-cuda-sdk --enable-libnpp
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 19.101 / 58. 19.101
libavformat 58. 13.102 / 58. 13.102
libavdevice 58. 4.100 / 58. 4.100
libavfilter 7. 22.100 / 7. 22.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100

Guessed Channel Layout for Input Stream #0.1 : stereo
Guessed Channel Layout for Input Stream #0.2 : stereo
Input #0, mxf, from '/home/me/Arrow_S04_B04.MXF':

Metadata:

uid : 37d0fdea-1bc0-4455-92d6-1a95fe12137e
generation_uid : 16e6e6fd-cd1d-49d8-a272-5d32b194dc76
company_name : Thomson Canopus Co., Ltd.
product_name : CMXFAPI
product_version : 6.0.0.0.0
product_uid : 0435c56c-a1eb-4a2e-a70b-9f1c73b0d788
modification_date: 2017-09-25T09:34:21.000000Z
material_package_umid: 0x060A2B340101010501010D201300000061466B75E26A4175B42D89FEF929CD23
timecode : 00:00:32:09

Duration: 00:05:17.36, start: 0.000000, bitrate: 19880 kb/s

Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 15000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:

file_package_umid: 0x060A2B340101010501010D2013000000842941BD609C44D6A7D018261F89A407

Stream #0:1: Audio: pcm_s24le, 48000 Hz, stereo, s32 (24 bit), 2304 kb/s
Metadata:

file_package_umid: 0x060A2B340101010501010D2013000000842941BD609C44D6A7D018261F89A407

Stream #0:2: Audio: pcm_s24le, 48000 Hz, stereo, s32 (24 bit), 2304 kb/s
Metadata:

file_package_umid: 0x060A2B340101010501010D2013000000842941BD609C44D6A7D018261F89A407

Input #1, srt, from '/home/me/Arrow_Test_S04_Ep04.srt':

Duration: N/A, bitrate: N/A

Stream #1:0: Subtitle: subrip

File '/home/me/output.ts' already exists. Overwrite ? [y/N] y
Stream mapping:

Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (pcm_s24le (native) -> aac (native))
Stream #1:0 -> #0:2 (subrip (srt) -> dvb_subtitle (dvbsub))

Press [q] to stop, ? for help
[libx264 @ 0x1b9ffc0] using SAR=1/1
[libx264 @ 0x1b9ffc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x1b9ffc0] profile High, level 4.0
Output #0, mpegts, to '/home/me/output.ts':

Metadata:

uid : 37d0fdea-1bc0-4455-92d6-1a95fe12137e
generation_uid : 16e6e6fd-cd1d-49d8-a272-5d32b194dc76
company_name : Thomson Canopus Co., Ltd.
product_name : CMXFAPI
product_version : 6.0.0.0.0
product_uid : 0435c56c-a1eb-4a2e-a70b-9f1c73b0d788
modification_date: 2017-09-25T09:34:21.000000Z
material_package_umid: 0x060A2B340101010501010D201300000061466B75E26A4175B42D89FEF929CD23
timecode : 00:00:32:09
encoder : Lavf58.13.102
Stream #0:0: Video: h264 (libx264), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 25 fps, 90k tbn, 25 tbc
Metadata:

file_package_umid: 0x060A2B340101010501010D2013000000842941BD609C44D6A7D018261F89A407
encoder : Lavc58.19.101 libx264

Side data:

cpb: bitrate max/min/avg: 2000000/0/2000000 buffer size: 2000000 vbv_delay: -1

Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (24 bit), 128 kb/s
Metadata:

file_package_umid: 0x060A2B340101010501010D2013000000842941BD609C44D6A7D018261F89A407
encoder : Lavc58.19.101 aac

Stream #0:2: Subtitle: dvb_subtitle (dvbsub), 1920x1080
Metadata:

encoder : Lavc58.19.101 dvbsub

frame= 768 fps= 55 q=-1.0 Lsize= 6970kB time=00:00:37.75 bitrate=1512.2kbits/s speed=2.71x
video:5869kB audio:469kB subtitle:1kB other streams:0kB global headers:0kB muxing overhead: 9.961083%
[libx264 @ 0x1b9ffc0] frame I:25 Avg QP:23.86 size: 44905
[libx264 @ 0x1b9ffc0] frame P:241 Avg QP:27.02 size: 11859
[libx264 @ 0x1b9ffc0] frame B:502 Avg QP:28.72 size: 4043
[libx264 @ 0x1b9ffc0] consecutive B-frames: 8.1% 7.8% 19.5% 64.6%
[libx264 @ 0x1b9ffc0] mb I I16..4: 32.6% 65.5% 1.9%
[libx264 @ 0x1b9ffc0] mb P I16..4: 9.6% 12.8% 0.1% P16..4: 26.4% 2.2% 2.2% 0.0% 0.0% skip:46.6%
[libx264 @ 0x1b9ffc0] mb B I16..4: 0.6% 0.6% 0.0% B16..8: 26.6% 0.5% 0.1% direct: 0.3% skip:71.3% L0:41.0% L1:58.3% BI: 0.7%
[libx264 @ 0x1b9ffc0] 8x8 transform intra:59.0% inter:96.8%
[libx264 @ 0x1b9ffc0] coded y,uvDC,uvAC intra: 21.4% 48.5% 10.6% inter: 3.9% 9.1% 0.2%
[libx264 @ 0x1b9ffc0] i16 v,h,dc,p: 41% 26% 11% 21%
[libx264 @ 0x1b9ffc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 15% 43% 2% 2% 2% 2% 2% 2%
[libx264 @ 0x1b9ffc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 22% 16% 5% 7% 7% 6% 5% 4%
[libx264 @ 0x1b9ffc0] i8c dc,h,v,p: 63% 17% 17% 3%
[libx264 @ 0x1b9ffc0] Weighted P-Frames: Y:3.7% UV:2.9%
[libx264 @ 0x1b9ffc0] ref P L0: 61.8% 10.7% 20.3% 7.2% 0.1%
[libx264 @ 0x1b9ffc0] ref B L0: 87.0% 10.6% 2.4%
[libx264 @ 0x1b9ffc0] ref B L1: 96.1% 3.9%
[libx264 @ 0x1b9ffc0] kb/s:1565.12
[aac @ 0x1ba1340] Qavg: 2551.740
Exiting normally, received signal 2.

Full FFmpeg Log 2:

2-gf995aa8 Copyright (c) 2000-2018 the FFmpeg developers

built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --prefix=/opt/ffmpeg --enable-nonfree --enable-gpl --extra-cflags='-I/opt/ffmpeg/include -I/usr/local/include -I/usr/local/cuda/include -I/opt/ndi/sdk/include' --extra-ldflags='-L/opt/ffmpeg/lib -L/usr/local/cuda/lib64 -L/opt/ndi/sdk/lib' --bindir=/opt/ffmpeg/bin --extra-libs=-ldl --enable-libx264 --enable-libx265 --enable-nonfree --enable-gpl --enable-nvenc --enable-libzvbi --enable-libfdk-aac --enable-libzimg --enable-libzmq --enable-libfreetype --enable-static --enable-shared --enable-hardcoded-tables --enable-vdpau --enable-cuda --enable-cuvid --enable-libvpx --enable-libmp3lame --enable-libndi_newtek --enable-openssl --enable-ffnvcodec --enable-libfontconfig --enable-libfribidi --enable-cuda-sdk --enable-libnpp
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 19.101 / 58. 19.101
libavformat 58. 13.102 / 58. 13.102
libavdevice 58. 4.100 / 58. 4.100
libavfilter 7. 22.100 / 7. 22.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100

Input #0, mpegts, from '/home/me/output.ts':

Duration: 00:00:30.74, start: 1.458667, bitrate: 1857 kb/s
Program 1

Metadata:

service_name : Service01
service_provider: FFmpeg

Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 121 kb/s
Stream #0:2[0x102](und): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)

Output #0, mpegts, to '/dev/null':

Metadata:

encoder : Lavf58.13.102
Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 121 kb/s
Stream #0:2(und): Subtitle: dvb_subtitle (dvbsub)
Metadata:

encoder : Lavc58.19.101 dvbsub

Stream mapping:

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (dvb_subtitle (dvbsub) -> dvb_subtitle (dvbsub))

Press [q] to stop, ? for help
[dvbsub @ 0x7286c0] [IMGUTILS @ 0x7ffee8adda00] Picture size 0x0 is invalid

Last message repeated 13 times

frame= 768 fps=0.0 q=-1.0 Lsize= 6961kB time=00:00:30.72 bitrate=1856.4kbits/s speed=1.14e+03x

Change History (7)

comment:1 Changed 3 months ago by cehoyos

  • Keywords dvbsub canvas_size removed
  • Resolution set to invalid
  • Status changed from new to closed

I am closing this because the command line does not match the console output but please understand that the conversion from text subtitle to bitmap subtitle simply doesn't exist in current FFmpeg.

comment:2 Changed 3 months ago by smallishzulu

Honestly, I copied the command line and its output from SSH. I dont understand which part does not match. Please let me know, so I corrent it in the ticket.

So, it means that text based subtitles such as SRT, DVB Teletext, etc. are not possible to be convert to Bitmap based subtitles like DVB Subtitle.

I think it will be nice to add code to throw error in such convertion try. It is really confusing because you see some packets in DVB subtitle PID, also using Subtitle Edit app (from http://www.nikse.dk/subtitleedit/) you can see subtitle timings and durations. That app gives out WxH missing info like 2nd FFmpeg command I posted.

Last edited 3 months ago by smallishzulu (previous) (diff)

comment:3 Changed 3 months ago by cehoyos

  • Component changed from undetermined to ffmpeg
  • Keywords sub added
  • Priority changed from normal to minor
  • Version changed from unspecified to git-master

No error is shown for an impossible conversion.

For future tickets: Please always use code blocks and post the command line you tested together with the complete, uncut console output, do not mix command lines and console output like in this ticket.

comment:4 Changed 3 months ago by cehoyos

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:5 Changed 3 months ago by smallishzulu

Well noted. I will follow your instruction.

Yes, there is no error for impossible conversion. Conversion seems happened. However as I said, dvbsub is not displayable in any player. I thought the reason was related with timings/timestamps, however it is not. The problem seems like no dimension (canvas) information.

I tried transcoding with VLC as well (dvbteletext to dvbsub). It has the same problem.
(I tested it as it has some alternative dvbsub encoding code.)

comment:6 Changed 3 months ago by cehoyos

  • Summary changed from DVBSub Encoding Missing WxH Info to No error for attempted conversion from text subtitles to bitmap subtitles.

comment:7 Changed 2 months ago by cehoyos

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.