Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#11487 closed Patch - Feature (Fixed)

Extend IPTV recorder to support TS streams over HTTP

Reported by: torbjorn.jansson@… Owned by: jpoet
Priority: minor Milestone: 0.27.6
Component: MythTV - Recording Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

hi.

i have made a patch against 0.26-fixes that extends the iptv recorder to support transport streams over http. i wrote this primarily to make streaming channels from my dm800 dreambox work via the enigma2 web interface but it is generic enough so any ts stream over http should work.

some notes about the changes i did:
the format of the m3u file is extended to support a new optional line for specifying the service id. this was needed because the current implementation of the iptv recorder was relying on a hard coded value of 1, if you leave out this new option it will fall back to the old behavior of using service id=1
format of the new m3u config option is:

#EXTMYTHTV2:serviceid=1234

where 1234 is your service id.

"unfortunately" this patch depends on the commoncpp2 library. the reason for that is because i was not able to convince the QTs http classes to work properly without any event loop used with gui applications. there is no fancy config check for this since i didn't know exactly how to make the new additions conditional depending on a config check.

i've been running with this for several weeks without any issues.


i have also written a little helper php script to generate the correct m3u file directly by using the web api in enigma2. this allows you to point your iptv recorder to this script and the channel list will be dynamically downloaded from your dreabox.

the script called dbox2m3u.php have a few http get variables you need to specify and there is also some default config variables in the php source also like your mysql hostname and logon information.

the script also attempts to fill in the right xmltvid in the m3u file based on your existing channels (limiting by sourceid is possible so only a specific capture source is used, like the one for the dreambox or another card with same channels)

if you don't specify the needed http get options in the url you get a very simple form for testing and specifying the right options.

the options are:

* host
  this is your ip or hostname to your dreambox.
  this one is mandatory
* bouquet
  this is the bouquet on your dreambox with the channels, for example "Favourites (TV)"
  this one is mandatory too
* sourceid
  used to limit the lookup of xmltvids to a specific capture card source.
  if you don't specify this option all your existing channels will be search by name for a match, and if one is found the xmltv id of that channel is used in the m3u file.
* webifport
  optional, port number of your enigma2 web interface.
* streamport
  optional, port number used for streaming.
  i don't think you need to change this.

example url:

http://yourserver/dbox2m3u.php?host=yourdreambox&bouquet=Favourites+(TV)

example output:

#EXTM3U
#EXTINF:0,21 - CNN
#EXTMYTHTV2:serviceid=1160
http://yourdreambox:8001/1:0:1:488:3FE:22F1:EEEE0000:0:0:0:
#EXTINF:0,22 - MTV
#EXTMYTHTV2:serviceid=940
http://yourdreambox:8001/1:0:1:3AC:457:22F1:EEEE0000:0:0:0:

Attachments (3)

iptv-http-ts-streaming.patch (11.9 KB) - added by torbjorn.jansson@… 6 years ago.
the patch
dbox2m3u.php (4.4 KB) - added by torbjorn.jansson@… 6 years ago.
the php helper script to generate m3u files from enigma2
0002-extend-IPTV-recorder-to-handle-MTPS-input.patch (4.8 KB) - added by Karl Egly 5 years ago.
bring the MPTS service selection forward to master / 0.27 - draft

Download all attachments as: .zip

Change History (19)

Changed 6 years ago by torbjorn.jansson@…

the patch

Changed 6 years ago by torbjorn.jansson@…

Attachment: dbox2m3u.php added

the php helper script to generate m3u files from enigma2

comment:1 Changed 6 years ago by torbjorn.jansson@…

just realized the example above didnt include the xmltv line because i dont have one specified.

comment:2 Changed 6 years ago by torbjorn.jansson@…

one more thing, if you want to use this with a dreambox make sure you don't group your channels on the dreambox. if you do, the service ref from the enigma2 web interface wont work and mythtv cant tune to the channel.

the reason for this is because the service ref from enigma2 doesn't include the serviceid. if you think about it it makes sense because there is no single value that can match multiple different values depending on what channel you ended up on.

comment:3 Changed 6 years ago by stuartm

Summary: Exten iptv recorder to support ts streams over httpExtend IPTV recorder to support TS streams over HTTP

comment:4 Changed 6 years ago by dekarl@…

#EXTM3U
#EXTINF:0,21 - CNN
#EXTMYTHTV2:serviceid=1160
http://yourdreambox:8001/1:0:1:488:3FE:22F1:EEEE0000:0:0:0:
#EXTINF:0,22 - MTV
#EXTMYTHTV2:serviceid=940
http://yourdreambox:8001/1:0:1:3AC:457:22F1:EEEE0000:0:0:0:

I'm not sure I understand "the service ref from enigma2 doesn't include the serviceid" correctly. Isn't the ref part of the http url? The service_id is there, encoded in hex.

1160 == 0x488
 940 == 0x3AC

Also the recorder should pick up any service_id if there is only one service on the transport. I take it engima does not rewrite the PAT/SDT when streaming to only contain one channel?

comment:5 Changed 6 years ago by johan@…

I don't want to hijack this bugreport, but I stumbled accross it when trying to get IPTV working with a TBS MOI Streaming Box.

I welcome the addition of a new M3U tag to specify the service ID as I use a satellite DVB-S2 to IPTV box and allmost all broadcasts have multiple IDs in the same stream.

MythTV can't handle them, while the same streams play correctly with VLC or mplayer.

(HandlePAT) DTVSM(): Program #1 not found in PAT!#012Program Association Section#012 PSIP tableID(0x0) length(17) extension(0x451)#012      version(9) current(1) section(0) last_section(0)#012      tsid(1105) programCount(2)#012  program number     0 has PID 0x0010#012  program number  4016 has PID 0x0844

(ProcessPAT) ProcessPAT: Program not found in PAT. Rescan your transports.

(CreatePATSingleProgram) Desired program #1 not found in PAT.#012#011#011#011Cannot create single program PAT.

comment:6 Changed 6 years ago by jpoet

Owner: changed from danielk to jpoet
Status: newaccepted

comment:7 in reply to:  5 Changed 6 years ago by Karl Egly

Replying to johan@…:

I don't want to hijack this bugreport

then don't :-)

I welcome the addition of a new M3U tag to specify the service ID as I use a satellite DVB-S2 to IPTV box and allmost all broadcasts have multiple IDs in the same stream.

MythTV can't handle them, while the same streams play correctly with VLC or mplayer.

(HandlePAT) DTVSM(): Program #1 not found in PAT!#012Program Association Section#012 PSIP tableID(0x0) length(17) extension(0x451)#012      version(9) current(1) section(0) last_section(0)#012      tsid(1105) programCount(2)#012  program number     0 has PID 0x0010#012  program number  4016 has PID 0x0844

(ProcessPAT) ProcessPAT: Program not found in PAT. Rescan your transports.

(CreatePATSingleProgram) Desired program #1 not found in PAT.#012#011#011#011Cannot create single program PAT.

you have found a new bug. MythTV should notice that the PAT contains only a single program with program_number 4016 and use that instead. Its likely getting confused by the mention of a program_number 0 which indices a non-standard PID of the network_information_sections (not 0x10, which it is in your sample, if you can influence the provider you may want to drop that information as its not needed) and is not a service in itself!

Please open a fresh bugreport.

The addition of a service_id makes sense to support transport streams that really do carry multiple services though.

comment:8 Changed 6 years ago by johan@…

New bug created: #11791

Last edited 5 years ago by Karl Egly (previous) (diff)

comment:9 Changed 6 years ago by jpoet

Version: 0.26-fixesMaster Head

Changed 5 years ago by Karl Egly

bring the MPTS service selection forward to master / 0.27 - draft

comment:10 Changed 5 years ago by Karl Egly

The new patch for the service_id selection is only compile tested. Changes to the original patch:

  • brought forward to 0.27 (or newer)
  • replaced custom extension with existing VLC extension so one playlist can in principle be used by both programs

I'm not sure how to test this. Any help with testing (unit testing or against an actual stream) is appreciated.

comment:11 Changed 5 years ago by Karl Dietz <dekarl@…>

In 6e91c46696ce6bbf56652e7301bbec53f127c3af/mythtv:

extend IPTV recorder to handle MTPS input

By parsing VLC style program_number from the playlist the recorder
can select a specific program from the stream. The program_number
is also known as the service_id in DVB vocabulary.

Example playlist:

#EXTM3U
#EXTINF:0,1 - name of the program
#EXTVLCOPT:program=61200
http://192.168.1.100:8001/1:0:19:EF10:421:1:C00000:0:0:0:

Original patch by Torbjörn Jansson
Refs #11487

comment:12 Changed 5 years ago by Karl Egly

see also #12168

comment:13 Changed 5 years ago by Karl Egly

I'm closing this ticket as everything has been implemented or superseded by #12168.

comment:14 Changed 5 years ago by Karl Egly

Resolution: Fixed
Status: acceptedclosed

comment:15 Changed 4 years ago by Karl Dietz <dekarl@…>

In 36f04c4d89191a7d0e7516d0fdd5b4c517d3cd3e/mythtv:

extend IPTV recorder to handle MPTS input

By parsing VLC style program_number from the playlist the recorder
can select a specific program from the stream. The program_number
is also known as the service_id in DVB vocabulary.

Example playlist:

#EXTM3U
#EXTINF:0,1 - name of the program
#EXTVLCOPT:program=61200
http://192.168.1.100:8001/1:0:19:EF10:421:1:C00000:0:0:0:

Original patch by Torbjörn Jansson
Refs #11487

(cherry picked from commit 6e91c46696ce6bbf56652e7301bbec53f127c3af)

comment:16 Changed 4 years ago by Karl Egly

Milestone: unknown0.27.6
Note: See TracTickets for help on using tickets.