[FFmpeg-user] How to get DVB-Teletxt into MP4

Robin A. Jensen RAJensen at youmail.dk
Sun Feb 9 18:43:39 EET 2020


Den 09-02-2020 kl. 15:16 skrev Robin A. Jensen via ffmpeg-user:
>
> Den 09-02-2020 kl. 02:19 skrev Reino Wijnsma:
>> On 2020-02-09T01:59:53+0100, Robin A. Jensen via ffmpeg-user 
>> <ffmpeg-user at ffmpeg.org> wrote:
>>> ffmpeg -txt_format text -txt_page 599 -ss 00:04:45 -i 'Beck_ _je for 
>>> _je (4).ts' -to 00:05:00 -map 0:s:0 -c:s:2 mov_text -metadata:s:2 
>>> language=dan 'Beck _je for _je (4).srt'
>>> The -txt_page number i get by using VLC. So now i have the .srt 
>>> file. Don't know how else to get ffmpeg to pick that one subtitle.
>>> Then i encode my video as i always do.
>>> Then i combine it with:
>>> ffmpeg -i 'Beck _je for _je (4).mp4' -i 'Beck _je for _je (4).srt' 
>>> -c:v copy -c:a copy -c:s mov_text 'test.mp4'
>>> This seems to be working. But is a long way to go.
>> ffmpeg -ss 00:04:45 -c:v h264_mmal -i 'Beck_ _je for _je (4).ts' -to 
>> 00:05:00 -map 0:0 -c:v h264_omx -b:v 4800k -map 0:2 -map 0:3 -c:a 
>> copy -map 0:1 -txt_format text -txt_page 599 -c:s mov_text 
>> -metadata:s:s language=dan 'Beck Øje for øje (4).mp4'
>>
>> Wouldn't this work? But again, without a sample we can't verify.
>>
>> -- Reino
>> _______________________________________________
>>
>> Hey Reino.
>> Just a test as you suggestet, but it will create a new error. I 
>> correctet the channels that need to be encoded.
> ffmpeg -ss 00:04:45 -c:v h264_mmal -i 'Beck_ _je for _je (4).ts' -to 
> 00:05:00 -map 0:0 -c:v h264_omx -b:v 4800k -map 0:2 -c:a copy -map 0:1 
> -txt_format text -txt_page 599 -c:s mov_text -metadata:s:s 
> language=dan 'Beck _je for _je (4).mp4'
> ffmpeg version git-2020-02-08-adea33f Copyright (c) 2000-2020 the 
> FFmpeg developers
>   built with gcc 8 (Raspbian 8.3.0-6+rpi1)
>   configuration: --arch=armhf --enable-gpl --enable-nonfree 
> --enable-omx --enable-omx-rpi --enable-mmal --enable-libzvbi
>   libavutil      56. 39.100 / 56. 39.100
>   libavcodec     58. 68.100 / 58. 68.100
>   libavformat    58. 38.100 / 58. 38.100
>   libavdevice    58.  9.103 / 58.  9.103
>   libavfilter     7. 75.100 /  7. 75.100
>   libswscale      5.  6.100 /  5.  6.100
>   libswresample   3.  6.100 /  3.  6.100
>   libpostproc    55.  6.100 / 55.  6.100
> [h264 @ 0x3579c90] Increasing reorder buffer to 2
> [mpegts @ 0x35744d0] start time for stream 4 is not set in 
> estimate_timings_from_pts
> [mpegts @ 0x35744d0] PES packet size mismatch
> [mpegts @ 0x35744d0] Packet corrupt (stream = 2, dts = 3024240201).
> [mpegts @ 0x35744d0] PES packet size mismatch
> [mpegts @ 0x35744d0] Packet corrupt (stream = 3, dts = 3024240201).
> Input #0, mpegts, from 'Beck_ _je for _je (4).ts':
>   Duration: 01:42:01.16, start: 27482.817233, bitrate: 9647 kb/s
>   Program 7310
>     Metadata:
>       service_name    : C More Hits
>       service_provider: YouSee
>     Stream #0:0[0x99c]: Video: h264 (High) ([27][0][0][0] / 0x001B), 
> yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 
> 50 tbr, 90k tbn, 50 tbc
>     Stream #0:1[0x99e](swe,nor,dan,fin): Subtitle: dvb_teletext 
> ([6][0][0][0] / 0x0006)
>     Stream #0:2[0x9a2](dan): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 
> stereo, fltp, 384 kb/s
>     Stream #0:3[0x9a3](nor): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 
> stereo, fltp, 384 kb/s
>   No Program
>     Stream #0:4[0x12]: Data: epg
> File 'Beck _je for _je (4).mp4' already exists. Overwrite? [y/N] y
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 (h264_mmal) -> h264 (h264_omx))
>   Stream #0:2 -> #0:1 (copy)
>   Stream #0:1 -> #0:2 (dvb_teletext (libzvbi_teletextdec) -> mov_text 
> (native))
> Error while opening encoder for output stream #0:2 - maybe incorrect 
> parameters such as bit_rate, rate, width or height
> _______________________________________________
I finally got the right commandline. I'll provide this solution for 
others, so they don't have to spend so much time on a simple task.
Input file info:
Input #0, mpegts, from 'Beck_ _je for _je (4).ts':
   Duration: 01:42:01.16, start: 27482.817233, bitrate: 9647 kb/s
   Program 7310
     Metadata:
       service_name    : C More Hits
       service_provider: YouSee
     Stream #0:0[0x99c]: Video: h264 (High) ([27][0][0][0] / 0x001B), 
yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 
tbr, 90k tbn, 50 tbc
     Stream #0:1[0x99e](swe,nor,dan,fin): Subtitle: dvb_teletext 
([6][0][0][0] / 0x0006)
     Stream #0:2[0x9a2](dan): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 
stereo, fltp, 384 kb/s
     Stream #0:3[0x9a3](nor): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 
stereo, fltp, 384 kb/s
   No Program
     Stream #0:4[0x12]: Data: epg

To be encided: Video 0:0, Audio 0:2 and subtitle stream 0:1:2 (dan)
It's importent to have -txt_format text -txt_page 599 -fix_sub_duration 
in front of input file.
The number for txt_page 599 is found by playing file in VLC and choose 
the subtitle needed. It will be showed in the tele-text area.
-fix_sub_duration will ensure that the subtitle is showed one by one. 
Without it, first subtitle come on to screen. Then the second will push 
the first one up on screen. The third subtitle will push 1. and 2. 
subtitle up and after 5 subtitles, your screen is full of subtitles!
So i ended up with this commandline for the file:

ffmpeg -txt_format text -txt_page 599 -fix_sub_duration -ss 00:02:40 
-c:v h264_mmal -i 'Beck_ _je for _je (4).ts' -to 01:32:10 -map 0:0 -c:v 
h264_omx -b:v 4800k -map 0:2 -c:a copy -map 0:1 -c:s:0 mov_text 
-metadata:s:s language=dan 'Beck(4).mp4'

Issue is closed.



More information about the ffmpeg-user mailing list