Project

General

Profile

Bug #900

ts-stream not correct

Added by none none over 12 years ago. Updated over 12 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
General
Target version:
-
Start date:
2012-03-16
Due date:
% Done:

0%

Estimated time:
Found in version:
latest from git EricV
Affected Versions:

Description

I try to use https://github.com/EricV/tvheadend for my iptv box, but iptv box shows nothing :(

iptvbox can works only with ts http stream.
If i try ts steam from getstream - it works fine.
If i try to use vlc with this comand vlc -q -I dummy --no-syslog --daemon $paths --sout '#standard{access=http,mux=ts,dst=IP:PORT}' - iptvbox works fine!
Source input for vlc i take from tvheadend.
But with EricV tvheadend nothing works, url http://IP:PORT/stream/ts-channelid/8 shows nothing :(

But my desktop vlc open http://IP:PORT/stream/ts-channelid/8 ok, all fine.

So, somethnig wrong with ts in tvheadend?
Is it possible to fix?


Files

getstream.txt (11.7 KB) getstream.txt none none, 2012-03-17 10:28
tvheadend.txt (11.2 KB) tvheadend.txt none none, 2012-03-17 10:28
vlc.txt (11.5 KB) vlc.txt none none, 2012-03-17 10:28
tsinfo.getstream.txt (23.5 KB) tsinfo.getstream.txt none none, 2012-03-17 10:57
tsinfo.tvheadend.txt (1.02 KB) tsinfo.tvheadend.txt none none, 2012-03-17 10:57
tsinfo.vlc.txt (13 KB) tsinfo.vlc.txt none none, 2012-03-17 10:57
0001-Fix-missing-PAT-PMT-packets-in-MPEG-TS.patch (9.28 KB) 0001-Fix-missing-PAT-PMT-packets-in-MPEG-TS.patch Zdeněk Kopřivík, 2012-05-29 18:40
0002-Fix-missing-PAT-PMT-packets-in-MPEG-TS.patch (2.7 KB) 0002-Fix-missing-PAT-PMT-packets-in-MPEG-TS.patch Zdeněk Kopřivík, 2012-06-07 02:29

History

#1

Updated by Eric Valette over 12 years ago

First of all, this is not a tvheadend bug as the ts streaming feature is no more present in upstream patch. You better report bugs on my github tree.

Then frankly I do not understand your bug report so will try to verify what I understand.

On PC from my tvheadend, you manage to stream ts and display it correctly in VLC

vlc http://IP:PORT/stream/ts-channelid/8 works? In that case it is not a tvheadend problem alone but a bad interaction with your STB

Did you configure the network mask and permission correctly to allow iptv box. is the 8 channel config a HD or SD stream. Could you check with SD stream

#2

Updated by Eric Valette over 12 years ago

Juts tested with vlc, mplayer, mplayer2. Works well. Just I incorporated the TS streaming optimization which may starting a bit longer.

#3

Updated by none none over 12 years ago

Eric Valette - wrote:

First of all, this is not a tvheadend bug as the ts streaming feature is no more present in upstream patch. You better report bugs on my github tree.

Then frankly I do not understand your bug report so will try to verify what I understand.

On PC from my tvheadend, you manage to stream ts and display it correctly in VLC

vlc http://IP:PORT/stream/ts-channelid/8 works? In that case it is not a tvheadend problem alone but a bad interaction with your STB

Did you configure the network mask and permission correctly to allow iptv box. is the 8 channel config a HD or SD stream. Could you check with SD stream

Thanks for unswer!
Yes, I try to stream ts from your tvheadend, and it display correctly in VLC.
vlc http://IP:PORT/stream/ts-channelid/8 - works fine! But iptvbox shows nothing.
If I transcode with VLC to "ts" your tvheadend with VLC command '#standard{access=http,mux=ts,dst=IP:PORT}' - iptvbox display it correctly. All fine.
So, with network is all ok ;)
And I try SD channels from sat.
I understand, that i have too small info for you to fix it :(
And I have no access to iptvbox to fix something :( . But - if I run getstream instead of tvheadend - iptvbox all shows fine.

#4

Updated by Eric Valette over 12 years ago

Apparently, they just complain about the first TS packet non having a SPS/PPS information in first packet H264 Packet. Hardware decoder may be more picky with that.

#5

Updated by none none over 12 years ago

its imposible to fix ? ;)

And what is the difference between send ts from tvheadend, and send the same from tvheadend through VLC ? The same from tvheadend through VLC work fine with iptvbox.

#6

Updated by Eric Valette over 12 years ago

Could you dump a few packets of the two ts stream (original tvheadend and vlc one) ans run tsinfo on it?

mplayer -dumpstream -dumpfile TF1HD.ts http://funtwist.home:9981/stream/ts-channelid/22
Failed to read /etc/mplayer/mplayer.conf.local: No such file or directory
Warning unknown option include at line 177
MPlayer SVN-r34809 (C) 2000-2012 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing http://funtwist.home:9981/stream/ts-channelid/22.
Resolving funtwist.home for AF_INET...
Connecting to server funtwist.home[192.168.8.12]: 9981...

Cache size set to 320 KBytes
Stream not seekable!
dump: 5472256 bytes written

MPlayer interrupted by signal 2 in module: dumpstream
nop_streaming_read error : Interrupted system call
Stream not seekable!
dump: 6016376 bytes written to 'TF1HD.ts'.
Core dumped ;)

Exiting... (End of file)
valette@pink-floyd2:~$ tsinfo TF1HD.ts
Reading from TF1HD.ts
Scanning 1000 TS packets

Packet 1 is PAT
Program list:
Program 1 -> PID 0fff (4095)

Packet 2 is PMT with PID 0fff (4095)
Program 1, version 0, PCR PID 0078 (120)
Program streams:
PID 0078 ( 120) -> Stream type 1b ( 27) H.264/14496-10 video (MPEG-4/AVC)
PID 0082 ( 130) -> Stream type 06 ( 6) H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)
ES info (9 bytes): 0a 04 66 72 61 00 7a 01 00
Languages: fra
Descriptor tag 7a (122) (1 byte): 00
PID 0083 ( 131) -> Stream type 06 ( 6) H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)
ES info (9 bytes): 0a 04 71 61 61 00 7a 01 00
Languages: qaa
Descriptor tag 7a (122) (1 byte): 00
PID 0084 ( 132) -> Stream type 06 ( 6) H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)
ES info (9 bytes): 0a 04 71 61 64 00 7a 01 00
Languages: qad
Descriptor tag 7a (122) (1 byte): 00
PID 008c ( 140) -> Stream type 06 ( 6) H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)
ES info (10 bytes): 59 08 66 72 61 10 00 01 00 01
subtitling_descriptor:
language='fra', subtitling_type=16
composition_page_id=1, ancillary_page_id=1
PID 008d ( 141) -> Stream type 06 ( 6) H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)
ES info (10 bytes): 59 08 66 72 61 10 00 02 00 02
subtitling_descriptor:
language='fra', subtitling_type=16
composition_page_id=2, ancillary_page_id=2

#7

Updated by Eric Valette over 12 years ago

pushed some optimization for http ts streaming part of a pull request from perexg

#8

Updated by none none over 12 years ago

./tsinfo vlc_rec.ts

Reading from vlc_rec.ts
Scanning 10000 TS packets

Packet 2 is PAT
Program list:
Program 1 -> PID 0042 (66)

Packet 3 is PMT with PID 0042 (66)
Program 1, version 9, PCR PID 0045 (69)
Program streams:
PID 0044 ( 68) -> Stream type 03 ( 3) 11172-3 audio (MPEG-1)
ES info (6 bytes): 0a 04 75 6b 72 00
Languages: ukr
PID 0045 ( 69) -> Stream type 02 ( 2) H.262/13818-2 video (MPEG-2) or 1117
2-2 constrained video

Found 44 PAT packets and 22 PMT packets in 10000 TS packets

./tsinfo tvheadend_mts.ts

Reading from tvheadend_mts.ts
Scanning 10000 TS packets

Packet 1 is PAT
Program list:
Program 1 -> PID 0fff (4095)

Packet 2 is PMT with PID 0fff (4095)
Program 1, version 0, PCR PID 182f (6191)
Program streams:
PID 182f (6191) -> Stream type 02 ( 2) H.262/13818-2 video (MPEG-2) or 1117
2-2 constrained video
PID 1830 (6192) -> Stream type 04 ( 4) 13818-3 audio (MPEG-2)
ES info (6 bytes): 0a 04 75 6b 72 00
Languages: ukr

Found 2 PAT packets and 1 PMT packet in 10000 TS packets

This is the same channel (and same time) - 5 Kanal (Ukraine) from sirius 4.8 (11766 H)

#9

Updated by Eric Valette over 12 years ago

From what I see, vlc adds more PAT/PMT packets. Really surprising. Video stream is identical except vlc renumbers the pids. But audio stream type is totally different. Could you also run mediainfo on them?

#10

Updated by none none over 12 years ago

I dont found it for linux, but found for win32.
So:
General
ID : 5850 (0x16DA)
Complete name : C:\ts\vlc_rec.ts
Format : MPEG-TS
File size : 47.9 MiB
Duration : 1mn 53s
Overall bit rate mode : Variable
Overall bit rate : 3 528 Kbps

Video
ID : 69 (0x45)
Menu ID : 1 (0x1)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : M=3, N=30
Codec ID : 2
Duration : 1mn 52s
Bit rate mode : Variable
Bit rate : 3 192 Kbps
Maximum bit rate : 15.0 Mbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.308
Stream size : 42.9 MiB (90%)

Audio
ID : 68 (0x44)
Menu ID : 1 (0x1)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Codec ID : 3
Duration : 1mn 53s
Bit rate mode : Constant
Bit rate : 160 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Compression mode : Lossy
Delay relative to video : -107ms
Stream size : 2.17 MiB (5%)
Language : Ukrainian

#11

Updated by none none over 12 years ago

General
ID : 1 (0x1)
Complete name : C:\ts\tvheadend_mts.ts
Format : MPEG-TS
File size : 47.5 MiB
Duration : 1mn 53s
Overall bit rate mode : Variable
Overall bit rate : 3 493 Kbps

Video
ID : 6191 (0x182F)
Menu ID : 1 (0x1)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : M=3, N=30
Codec ID : 2
Duration : 1mn 53s
Bit rate mode : Variable
Bit rate : 3 158 Kbps
Maximum bit rate : 15.0 Mbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.305
Stream size : 42.7 MiB (90%)

Audio
ID : 6192 (0x1830)
Menu ID : 1 (0x1)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Codec ID : 4
Duration : 1mn 53s
Bit rate mode : Constant
Bit rate : 160 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Compression mode : Lossy
Delay relative to video : -267ms
Stream size : 2.17 MiB (5%)
Language : Ukrainian

#12

Updated by none none over 12 years ago

Eric Valette - wrote:

pushed some optimization for http ts streaming part of a pull request from perexg

dosen`t helps :(

I try radio from sat, with ts stream - dont work, with -d it`s log:

[DEBUG]:webui: Start streaming /stream/ts-channelid/7
[INFO]:subscription: "HTTP" unsubscribing from "Love Radio"
[INFO]:subscription: "HTTP" subscribing on "Love Radio", weight: 100, adapter: "
Conexant CX24120/CX24118", network: "SIRIUS", mux: "SIRIUS: 11,766,000 kHz Horiz
ontal (Default (Port 0, Universal LNB))", provider: "Love Radio", service: "Love
Radio", quality: 100
[DEBUG]:Service: Conexant CX24120/CX24118/SIRIUS: 11,766,000 kHz Horizontal (Def
ault (Port 0, Universal LNB))/Love Radio: Status changed to [Hardware input]
[DEBUG]:Service: Conexant CX24120/CX24118/SIRIUS: 11,766,000 kHz Horizontal (Def
ault (Port 0, Universal LNB))/Love Radio: Status changed to [Hardware input] [In
put on service]
[DEBUG]:Service: Conexant CX24120/CX24118/SIRIUS: 11,766,000 kHz Horizontal (Def
ault (Port 0, Universal LNB))/Love Radio: Status changed to [Hardware input] [In
put on service] [Demuxed packets]
[DEBUG]:Service: Conexant CX24120/CX24118/SIRIUS: 11,766,000 kHz Horizontal (Def
ault (Port 0, Universal LNB))/Love Radio: Status changed to [Hardware input] [In
put on service] [Demuxed packets] [Reassembled packets]

in web:
Mar 17 01:14:21 subscription: "HTTP" subscribing on "Love Radio", weight: 100, adapter: "Conexant CX24120/CX24118", network: "SIRIUS", mux: "SIRIUS: 11,766,000 kHz Horizontal (Default (Port 0, Universal LNB))", provider: "Love Radio", service: "Love Radio", quality: 100

Mar 17 01:14:21 subscription: "HTTP" unsubscribing from "Love Radio"

Mar 17 01:14:22 subscription: "HTTP" subscribing on "Love Radio", weight: 100, adapter: "Conexant CX24120/CX24118", network: "SIRIUS", mux: "SIRIUS: 11,766,000 kHz Horizontal (Default (Port 0, Universal LNB))", provider: "Love Radio", service: "Love Radio", quality: 100

Mar 17 01:14:22 subscription: "HTTP" unsubscribing from "Love Radio"

In iptvbox no sound. In vlc sound ok, i hear radio music...

#13

Updated by none none over 12 years ago

this files - mediainfo in advanced mode

tvheadend - iptvbox dont show
vlc - iptvbox ok
getstream - iptvbox ok

All I see difference - in getstream and vlc is

"Inform : "

In tvheadend file no this option.

#14

Updated by none none over 12 years ago

and tsinfo -v :

why in tvheadend too small info ?

#15

Updated by Hein Rigolo over 12 years ago

  • Category set to 41
#16

Updated by none none over 12 years ago

wont fix

Why? Its imposible to fix?
As I think, tvheand send info (parametrs) of ts stream at first packets. But in real ts stream this info sends allways.
So - getstream work ok, and vlc stream work ok :(

But big advantage of tvheadend is that its decode on demand, when I watch any channel.
Getstream, or vlc - allways loads cpu.
All that remains for tvheadend is - use it with vlc on desktop :(

I would appreciate if you fix this problem, in any case, thank you for your attention and anwsers :)

#17

Updated by Hein Rigolo over 12 years ago

just as Eric said in his first comment under this bug, ... the ability to save or stream in ts format is not part of the standard tvheadend codebase, but developed and maintained outside of the main tvheadend code branch. Just to make it clear that this can not be solved in the main tvheadend branch I set the category to wont fix.

So you can continue discussing this issue here (I did not close the ticket) and work with Eric to get this issue fixed so that this code can be improved.

Hein

#18

Updated by Zdeněk Kopřivík over 12 years ago

I'm probably experiencing the same problem while trying to re-stream TS data from tvheadend using VDR (with iptv and streamdev plugins). Re-streaming as PS or PES works but TS does not because of missing info headers in the source stream.

Is this going to be fixed?

#19

Updated by Eric Valette over 12 years ago

Zdeněk Kopřivík wrote:

I'm probably experiencing the same problem while trying to re-stream TS data from tvheadend using VDR (with iptv and streamdev plugins). Re-streaming as PS or PES works but TS does not because of missing info headers in the source stream.

Is this going to be fixed?

The code that parse the PAT/PMT is in tsdemux.c. The code that write the first packet is in mkts.c. I guess repalcing PAT/PMT packet on the fly by corrected one should be fairly easy to had. I would prefer someone with the problematic hardware to write/test it...

#20

Updated by none none over 12 years ago

I can test it =)

#21

Updated by Zdeněk Kopřivík over 12 years ago

Please try attached patch (0001-Fix-missing-PAT-PMT-packets-in-MPEG-TS.patch).

It makes TVheadend send PAT/PMT per every 1000 packets. The stream is still not perfect since there are some bad PMTs with different PID left in the output and I was not able to fix that but those should be ignored by the reciever.

Zdenek Koprivik

#22

Updated by none none over 12 years ago

Zdenek Koprivik

thanks! It works fine on STB =)

I need some days for test how stable it work and the presence of artifacts.

I reported later

#23

Updated by Eric Valette over 12 years ago

none none wrote:

Zdenek Koprivik

thanks! It works fine on STB =)

I need some days for test how stable it work and the presence of artifacts.

I reported later

I applied the patch on my tree for a test run. Thanks for the time taken to produce it. I was able to apply it and run it but it generate a lot of error messages in vlc, so its not 100% perfect. Probably the PAT/PMT generation is not 100% correct. If someone can provide better code mk_ts_build_pat_pmt I will probably integrate it. I found code for it in vdr, old mythtv code but so far have no time to incorporate it/test it properly.

libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 4095
libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 4095
libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 4095

#24

Updated by Zdeněk Kopřivík over 12 years ago

Sorry for not responding so long (was busy with finishing the school). I didn't realize that every TS packet has a "continuity counter", so we can't simply generate one PAT/PMT packet and send it again and again (like my patch does), we need to increment the counter in the packet before sending it again. It should be easy to fix. I will look at it next week and make another patch.

#25

Updated by none none over 12 years ago

So, STB work fine without any trubles!

There is only one anomaly:

when STB connect to tvheadend it make two connections :

Jun 06 22:40:56 subscription: "HTTP" subscribing on "Первый", weight: 100, adapter: "ST STV0299 DVB-S 1", network: "TricolorTV", mux: "TricolorTV: 12,226,000 kHz Left (Default (Port 0, Universal LNB))", provider: "TricolorTV", service: "Первый", quality: 100
Jun 06 22:40:56 subscription: "HTTP" subscribing on "Первый", weight: 100, adapter: "ST STV0299 DVB-S 1", network: "TricolorTV", mux: "TricolorTV: 12,226,000 kHz Left (Default (Port 0, Universal LNB))", provider: "TricolorTV", service: "Первый", quality: 100
Jun 06 22:40:57 subscription: "HTTP" unsubscribing from "Первый"

So - two connects, which one immediatly disconnect.

But it works stable, fast, without artifacts.
Really respect for patch!

But I want to ask - PAT/PMT tables always present normaly in tv SAT TS stream, is it problem pass through always this tables from sat TS to http TS out ?

#26

Updated by Zdeněk Kopřivík over 12 years ago

The original TS stream contains many channels (the whole multiplex or transponder) and its PAT contains references to all of them. So TVheadend needs to parse the original PAT and then generate new one which contains only the reference to the channel which is being streamed out.

#27

Updated by none none over 12 years ago

And without patch, as I understand, tvheadend send PAT/PMT tables of stream only at any connect of any client? And it`s dosen`t send it always? But with patch it send always PAT/PMT, independently from source TS SAT stream?

#28

Updated by Zdeněk Kopřivík over 12 years ago

Yes. With the patch it sends 1 PAT/PMT for every 1000 TS packets.

Here is the fix for the continuity counter error that Eric reported (0002-Fix-missing-PAT-PMT-packets-in-MPEG-TS.patch).
It simply adds a counter (from 0 to 15 because there are only 4 bits) and writes the correct number to the PAT/PMT header (instead of static "0").

This patch requires the first one (0001-Fix-missing-PAT-PMT-packets-in-MPEG-TS.patch) to be already applied.

Zdenek

#29

Updated by Eric Valette over 12 years ago

After successful vlc/mplayer testing, I merged Zdeněk Kopřivík two patches in my tree. So this bug can be closed I guess.

#30

Updated by Hein Rigolo over 12 years ago

  • Status changed from New to Fixed
#31

Updated by none none over 12 years ago

Yes, I compile latest from git, and all works ok ;)

Thanks for fix!

#32

Updated by Zdeněk Kopřivík over 12 years ago

It still can be improved/optimized if we can stop PMTs from original stream from passing through to the output.

Also available in: Atom PDF