FFMpeg DVB-C TS - Trim + re-mux do MKV a MP4

Jigdo

  • ****
  • 499
    • Zobrazit profil
FFMpeg DVB-C TS - Trim + re-mux do MKV a MP4
« kdy: 25. 12. 2023, 15:00:04 »
Ano z iVysilani se da stahnout taky, ale mne zajima jak s tim TS streamem
pracovat v FFMpeg a nahravka ma AC-3 zvuk a titulky v teletex formatu ;)
https://www.ceskatelevize.cz/porady/16901-tri-orisky-pro-popelku/

#Verze FFMpeg
Kód: [Vybrat]
ffmpeg version N-112499-ga76b409dd0-20231022 Copyright (c) 2000-2023 the FFmpeg developers

Trim, se da udelat sucasne v prubehu remuxu do MKV/MP4 kontejneru, a nebo
je lepsi to delat pred/po remuxu?

Film zacina 00:07:30 a konci 01:30:43 a celkova delka je 01:38:02.10

Moje nahravka ma nasleduji spec a zkousim re-mux:

Kód: [Vybrat]
#FFProbe:
ffprobe -hide_banner 20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.ts


[mpegts @ 00000138902d2040] Packet corrupt (stream = 6, dts = 3977742639).
[mpegts @ 00000138902d2040] Could not find codec parameters for stream 7 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from '20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.ts':
  Duration: 01:38:02.10, start: 38315.036589, bitrate: 7994 kb/s
  Program 305
  Stream #0:0[0x456]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn
  Stream #0:1[0x460](cze): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:2[0x461](qaa): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:3[0x462](cze): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, 5.1(side), fltp, 448 kb/s
  Stream #0:4[0x463](cze): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, mono, fltp, 64 kb/s (visual impaired) (descriptions) (dependent)
  Stream #0:5[0x46a](cze): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006), 492x250
  Stream #0:6[0x47e](cze): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
  Stream #0:7[0x488]: Unknown: none ([5][0][0][0] / 0x0005)

Unsupported codec with id 0 for input stream 7

Kód: [Vybrat]
#TSDuck
tsanalyze --ts-analysis --service-analysis --pid-analysis --table-analysis 20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.ts
===============================================================================
|  SERVICES ANALYSIS REPORT                                                   |
|=============================================================================|
|  Global PID's                                                               |
|  TS packets: 58,808, PID's: 1 (clear: 1, scrambled: 0)                      |
|-----------------------------------------------------------------------------|
|     PID  Usage                                     Access          Bitrate  |
|   Total  Global PID's ................................. C       15,085 b/s  |
|   Subt.  Global PSI/SI PID's (0x00-0x1F) .............. C       15,085 b/s  |
|  0x0000  PAT .......................................... C       15,085 b/s  |
|=============================================================================|
|  Service: 0x0131 (305), TS: 0x0003 (3)                                      |
|  Service name: (unknown), provider: (unknown)                               |
|  Service type: 0x00 (Undefined)                                             |
|  TS packets: 31,208,008, PID's: 9 (clear: 9, scrambled: 0)                  |
|  PMT PID: 0x1B77 (7031), PCR PID: 0x0456 (1110)                             |
|-----------------------------------------------------------------------------|
|     PID  Usage                                     Access          Bitrate  |
|   Total  Undefined .................................... C    8,005,062 b/s  |
|  0x0456  AVC video (1920x1080, high profile, level 4.0  C    6,621,176 b/s  |
|  0x0460  MPEG-1 Audio (cze, Audio layer II, 256 kb/s,   C      267,120 b/s  |
|  0x0461  MPEG-1 Audio (qaa, Audio layer II, 192 kb/s,   C      204,268 b/s  |
|  0x0462  AC-3 Audio (cze, AC-3, 3/2 (L,C,R,SL,SR), @48  C      471,393 b/s  |
|  0x0463  MPEG-1 Audio (cze, visual impaired commentary  C       78,565 b/s  |
|  0x046A  Teletext (cze, Initial Teletext page) ........ C      226,265 b/s  |
|  0x047E  Subtitles (cze, DVB subtitles for hard of hea  C      129,753 b/s  |
|  0x0488  MPEG-2 Private sections (AIT) ................ C        1,041 b/s  |
|  0x1B77  PMT .......................................... C        5,482 b/s  |
|          (C=Clear, S=Scrambled, +=Shared)                                   |
|=============================================================================|

Prvni vec jsem zkousel jednoduchy re-mux:
ffmpeg -hide_banner -i 20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.ts -map 0 -c copy 20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.mkv -v verbose
ale samozrejmne ze ffmpeg vyhodil nasledujici chybu:

Kód: [Vybrat]
[mpegts @ 000001eec16b5640] Packet corrupt (stream = 6, dts = 3977742639).
[mpegts @ 000001eec16b5640] Could not find codec parameters for stream 7 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from '20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.ts':
  Duration: 01:38:02.10, start: 38315.036589, bitrate: 7994 kb/s
  Program 305
  Stream #0:0[0x456]: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(top first, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn
  Stream #0:1[0x460](cze): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:2[0x461](qaa): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:3[0x462](cze): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, 5.1(side), fltp, 448 kb/s
  Stream #0:4[0x463](cze): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, mono, fltp, 64 kb/s (visual impaired) (descriptions) (dependent)
  Stream #0:5[0x46a](cze): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006), 492x250
  Stream #0:6[0x47e](cze): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
  Stream #0:7[0x488]: Unknown: none ([5][0][0][0] / 0x0005)

[out#0/matroska @ 000001eec16ea980] Adding streams from explicit maps...
[vost#0:0/copy @ 000001eec3540580] Created video stream from input stream 0:0
[aost#0:1/copy @ 000001eec3c800c0] Created audio stream from input stream 0:1
[aost#0:2/copy @ 000001eec3c80700] Created audio stream from input stream 0:2
[aost#0:3/copy @ 000001eec4ab00c0] Created audio stream from input stream 0:3
[aost#0:4/copy @ 000001eec4ab0700] Created audio stream from input stream 0:4
[sost#0:5/copy @ 000001eec4ab09c0] Created subtitle stream from input stream 0:5
[sost#0:6/copy @ 000001eec4ab0c80] Created subtitle stream from input stream 0:6
[out#0/matroska @ 000001eec16ea980] Cannot map stream #0:7 - unsupported type.
[out#0/matroska @ 000001eec16ea980] If you want unsupported types ignored instead of failing, please use the -ignore_unknown option
If you want them copied, please use -copy_unknown
Error opening output file 20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.mkv.
Error opening output files: Invalid argument


a nelibi se mu stream 7.
Takze zkousim vynechat stream 7 s nasledujicim prikazem:

Kód: [Vybrat]
ffmpeg -hide_banner ^
-i 20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.ts ^
-map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -map 0:6 ^
-c copy ^
-map_metadata 0 ^
-f matroska ^
-ignore_unknown -copy_unknown ^
20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.mkv -v verbose

Ale to taky konci chybou:

Kód: [Vybrat]
   
[mpegts @ 0000024d51d24140] PES packet size mismatch
[mpegts @ 0000024d51d24140] Packet corrupt (stream = 6, dts = 3977742639).
[mpegts @ 0000024d51d24140] Could not find codec parameters for stream 7 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from '20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.ts':
  Duration: 01:38:02.10, start: 38315.036589, bitrate: 7994 kb/s
  Program 305
  Stream #0:0[0x456]: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(top first, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn
  Stream #0:1[0x460](cze): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:2[0x461](qaa): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:3[0x462](cze): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, 5.1(side), fltp, 448 kb/s
  Stream #0:4[0x463](cze): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, mono, fltp, 64 kb/s (visual impaired) (descriptions) (dependent)
  Stream #0:5[0x46a](cze): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006), 492x250
  Stream #0:6[0x47e](cze): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
  Stream #0:7[0x488]: Unknown: none ([5][0][0][0] / 0x0005)

[out#0/matroska @ 0000024d51d59040] Adding streams from explicit maps...
[aost#0:0/copy @ 0000024d55140440] Created audio stream from input stream 0:1
[aost#0:1/copy @ 0000024d55140ac0] Created audio stream from input stream 0:2
[aost#0:2/copy @ 0000024d51dbd380] Created audio stream from input stream 0:3
[aost#0:3/copy @ 0000024d51dbda00] Created audio stream from input stream 0:4
[sost#0:4/copy @ 0000024d51dbdcc0] Created subtitle stream from input stream 0:5
[sost#0:5/copy @ 0000024d5375b140] Created subtitle stream from input stream 0:6
[matroska @ 0000024d53cf7200] Tag [6][0][0][0] incompatible with output codec id '94215' ([0][0][0][0])
[out#0/matroska @ 0000024d51d59040] Could not write header (incorrect codec parameters ?): Invalid data found when processing input
Error opening output file 20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.mkv.
Error opening output files: Invalid data found when processing input
[AVIOContext @ 0000024d54310e80] Statistics: 0 bytes written, 0 seeks, 0 writeouts
[AVIOContext @ 0000024d51cebb40] Statistics: 5820560 bytes read, 3 seeks

A tady se to zastavilo u streamu "0:6 dvb_subtitle".

Takze ted hledam "ffmpeg dvb_subtitle"
https://trac.ffmpeg.org/wiki/ExtractSubtitles

Verze ffmpeg podporuje u "dvb_subtitle" i decoder, i encoder = dvbsub.


$ ffmpeg -hide_banner -codecs | grep subtitle
Kód: [Vybrat]
> ffmpeg -hide_banner -codecs | findstr subtitle
 DES... ass                  ASS (Advanced SSA) subtitle (decoders: ssa ass) (encoders: ssa ass)
 DES... dvb_subtitle         DVB subtitles (decoders: dvbsub) (encoders: dvbsub)
 DES... dvd_subtitle         DVD subtitles (decoders: dvdsub) (encoders: dvdsub)
 D.S... hdmv_pgs_subtitle    HDMV Presentation Graphic Stream subtitles (decoders: pgssub)
 ..S... hdmv_text_subtitle   HDMV Text subtitle
 D.S... jacosub              JACOsub subtitle
 D.S... microdvd             MicroDVD subtitle
 D.S... mpl2                 MPL2 subtitle
 D.S... pjs                  PJS (Phoenix Japanimation Society) subtitle
 D.S... realtext             RealText subtitle
 D.S... sami                 SAMI subtitle
 ..S... srt                  SubRip subtitle with embedded timing
 ..S... ssa                  SSA (SubStation Alpha) subtitle
 D.S... stl                  Spruce subtitle format
 DES... subrip               SubRip subtitle (decoders: srt subrip) (encoders: srt subrip)
 D.S... subviewer            SubViewer subtitle
 D.S... subviewer1           SubViewer v1 subtitle
 D.S... vplayer              VPlayer subtitle
 DES... webvtt               WebVTT subtitle


dvb_teletext ale chybi (v vypisu) ..:(
Aha ... : Your FFmpeg needs to be configured with --enable-libzvbi for this to work

$ ffmpeg -hide_banner -codecs | grep libzvbi
Kód: [Vybrat]
> ffmpeg -hide_banner -codecs | findstr libzvbi
 D.S... dvb_teletext         DVB teletext (decoders: libzvbi_teletextdec)

$ ffmpeg -hide_banner -decoders | grep zvb
Kód: [Vybrat]
> ffmpeg -hide_banner -decoders | findstr zvb
 S..... libzvbi_teletextdec  Libzvbi DVB teletext decoder (codec dvb_teletext)
Codecs:
 D..... = Decoding supported
 .E.... = Encoding supported, can convert into (subrip, ass, webvtt)
 ..V... = Video codec
 ..A... = Audio codec
 ..S... = Subtitle codec
 ..D... = Data codec
 ..T... = Attachment codec
 ...I.. = Intra frame-only codec
 ....L. = Lossy compression
 .....S = Lossless compression



Ale pokud z toho budu vytahovat ty titulky, tak je asi treba nahravku trimovat, jinak
asi nebudou sedet timestamps pozdeji .....
Takze jsem to takhle ostrihl (u CT nastesti nemaji v prubehu filmu reklamy):


Kód: [Vybrat]
ffmpeg -hide_banner ^
-i 20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.ts ^
-c copy -ss 00:07:30 -to 01:30:43 ^
-map 0 ^
-ignore_unknown -copy_unknown ^
CT1.HD.-.Tri.orisky.pro.Popelku.ts -v verbose

Nahravka ma pozadovanou delku, zkousim jeste prehravat v MPV, ale tady nefungovaly titulky,
nedaly se vubec vybrat/zmenit, zkousim nejnovejsi verzi MPV, a titulky uz funguj .... jak s daji zpustit ty teletex titulky
v MPV i VLC? (Ve VLC zkousim 888, ale nic a je to nejnovejsi verze 3.0.20).

https://mpv.io/manual/master/
--teletext-page=<1-999>
    This works for dvb_teletext subtitle streams, and if FFmpeg has been compiled with support for it.


mpv --teletext-page=888 --sid=1 CT1.HD.-.Tri.orisky.pro.Popelku.ts
Zapinam s "V" a prepinam na prvni stopu titulku, ale nic :(
Zkousim ty titulky vytahnout:


Kód: [Vybrat]
ffmpeg -hide_banner ^
-txt_format text -i CT1.HD.-.Tri.orisky.pro.Popelku.ts -map 0:5 CT1.HD.-.Tri.orisky.pro.Popelku.srt

Ale to nefunguje :(
Vysledny soubor obsahuje EPG data:

Kód: [Vybrat]
1
00:00:00,000 --> 1193:02:47,295

ČT1                       nedöle 24.12.

15.45 Byl jednou jeden krşl...    AD ST
- J.Werich ve filmovı pohşdce,
ve kterı zvÜtözÜ sğl nad zlatem
a moudrost nad hloupostÜ (1954)
17.25 O vşnoİnÜ hvözdö          D AD ST
- vÇpravnş pohşdka o princeznö,
zamilovanım uİiteli a z nebe
spadlı hvözdö Deniİce (2020)
19.00 KlÜİ svatıho Petra          AD ST
- premiıra pohşdky o tĞech mize-
rech, z nichÖ jeden je çplnö ne-
vinnÇ... (2023)
20.30 TĞi oĞÜüky pro Popelku      AD ST
- L.Šafrşnkovş a P.TrşvnÜİek ve
slavnı filmovı pohşdce (1973)
ms 




Pro jistotu zkousim, re-mux do MKV bez dvb_teletext/subtitle.
Kód: [Vybrat]
ffmpeg -hide_banner ^
-i 20231224.2027.-.CT1.HD.-.Tri.orisky.pro.Popelku.ts ^
-map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 ^
-ss 00:07:30 -to 01:30:43 ^
-c copy ^
-map_metadata 0 ^
-f matroska ^
-ignore_unknown -copy_unknown ^
CT1.HD.-.Tri.orisky.pro.Popelku-TRIM-NOSUB.mkv -v verbose




Poardi nekdo jak na ty titulky "dvb_teletext" a "dvb_subtitle"?



« Poslední změna: 25. 12. 2023, 23:41:04 od Petr Krčmář »


Jigdo

  • ****
  • 499
    • Zobrazit profil
Re:FFMpeg DVB-C TS - Trim + re-mux do MKV a MP4
« Odpověď #1 kdy: 25. 12. 2023, 18:35:05 »
Nejdu s dobou ... :(

Napadlo mne proverit funkcnost teletext titulku v zarizeni kde jsem to nahraval.
A po zapnuti teletextu a zmeny stranek na 888 se teletextove stranky nacitaji a bezi porad dokola a
titulky se nenactou ......dvb_subtitle funguji jak maji.

Je to chyba na strane DVB-C poskytovatele?
Pouziva nekdo teletext titulky na Vu+ s OpenPLi 8.3?

Proveruji, jestli skryte titulky v teletextu nabizeji, ale tady nic:
https://www.ceskatelevize.cz/vse-o-ct/jak-sledovat/televizni-signal/o-televiznim-vysilani/dodatkove-sluzby/skryte-titulky/

Aha, takze dvb_teletext = "Teletextové skryté podtitulky" uz nejsou podporovany ani u "Pozemni" ani u "Satelitni" distribuce
https://www.ceskatelevize.cz/vse-o-ct/jak-sledovat/televizni-signal/sireni-signalu/technicke-informace-o-signalu/