Contents
Preface
Actually, I have been struggling with this problem for many times over the years. It is not that there is any technical upgrade, but I have forgotten how to do it after a while. After all, I am old and my memory has declined. I can't remember how many times I have repeated the research. Now I have a blog, I can finally record it as a memo, but the reason I don't want to write it is: it is really hard to say that it has any great use. After all, I don't watch TV at all, so even if it realizes full media playback (mobile phones, tablets, TVs, computers, no matter where you are, you can watch IPTV directly), it is actually useless because I don't watch it. . But today I just happen to have some free time, so I'll take the opportunity to write this down.
Rationale
What is the essence of IPTV? It is a multicast protocol. I will not discuss the detailed working principle of multicast in detail. This is a set of protocols, which cannot be explained in a few words. If you are interested, you can search for the specific content on the Internet. If you use a simple sentence to summarize, you can think that a multicast packet is: a broadcast packet transmitted in the form of a unicast packet, but this broadcast packet can only be received by specific devices (in the same multicast group). So why did the TV set-top box of the telecom company have to be directly connected to the IPTV port on the optical modem in the past? Because this interface belongs to the IPTV multicast group and can receive IPTV multicast packets. Another feature of IPTV multicast packets is that the multicast packets will definitely reach all local devices (the nearest data access device where the ISP connects to the user's optical modem). As for whether the IPTV interface of your optical modem can join the IPTV multicast group, it depends on whether your home has opened the IPTV service.
So if we follow this logic, as long as my family has activated the IPTV service, can any device that supports the multicast protocol be connected to the IPTV port of the optical modem to receive IPTV packets? The answer is no, because there is an authentication step in the middle, which is to prevent you from connecting any device to the IPTV port to watch TV. After all, if there is no control, if you connect a Layer 2 switch that supports multicast to the IPTV port to expand it, then any number of devices that support multicast can be connected to the switch to watch IPTV? Then how can Telecom sell the second and third set-top boxes to the same family? After all, each additional set-top box will bring an additional 20 yuan in revenue per month.
Therefore, when you install a new IPTV, a telecom engineer will come to your home to activate it. This activation means entering the information of your telecom set-top box (usually the MAC address) into the telecom back-end system, making your set-top box a legal citizen, so that it can pass authentication and join the IPTV anchor group through the IPTV port, and finally receive TV programs.
As for the specific methods of authentication, there are many, for example, some places use PPPoE dial-up, and some places use DHCP option (such as Chengdu Telecom). You have to confirm it yourself. Generally, if there are local pioneers on the Internet who have written articles, it will save a lot of trouble. I captured the packets and analyzed them myself.
I have talked about the principle for a long time. If I want to complete the so-called IPTV "full media playback" through iQiyi, I need to solve three main problems:
1. Authentication issues
It is necessary to deceive the telecommunications company and authenticate the IPTV port of the telecommunications company on behalf of the telecommunications set-top box in order to receive the IPTV multicast packet.
2. Protocol conversion issues
To convert IPTV multicast packets into the method required for "full media playback".
3. Obtaining the multicast address corresponding to each channel
In fact, to solve the above three problems, there is a potential condition, that is, your router supports "multi-dial". Why? Because a normal router has only one wan port, this wan port must be connected to the data port of the optical modem (in fact, many optical modems now do not distinguish between data ports and IPTV ports, and each port can be used as a data port or IPTV port), and IPTV authentication also requires the router to use a wan port to connect to the IPTV port of the optical modem, so at least 2 wan ports are required (essentially multi-line multi-dial). Of course, if the export router does not support multi-dial, you can also use the wan port of another router to connect to the IPTV port of the optical modem (of course, the premise is that this router supports IPTV authentication), and then connect the lan port to the intranet switch to achieve this. However, this method is obviously much less technically advanced than the method that can be achieved with a router, and it does not deserve my name of invincibility.
Authentication
There are many ways to authenticate, the most common ones are PPPoE and DHCP. Relatively speaking, PPPoE is the simplest, because basically all devices support PPPoE, and there is no threshold. If the authentication method of IPTV in your area is PPPoE, then congratulations, this step will save you a lot of trouble. However, Chengdu Telecom's IPTV happens to use DHCP, and this DHCP is not a common DHCP, and it also needs to support option 60 and 61.
How to determine which method your IPTV uses? The most convenient way is to search online. If someone in the same area has done it and posted a post, then congratulations, you can use it directly. For example, if a Chengdu Telecom IPTV user sees this post, then he will naturally know the authentication method. The rest is to know the MAC address of the set-top box. How do you know the MAC address of the set-top box? Turn the set-top box over, and it will be written on the back.
However, I will still briefly talk about how to determine the authentication method of the set-top box. This requires a certain network foundation and the ability to capture packets and analyze the contents of packets. In short, you can connect the set-top box to a device that can capture packets, including but not limited to switches that support port mirroring, soft routers, or dedicated devices, as follows:
The device is described as follows:
I will not explain how to use it specifically, you can study it slowly. Here I directly use the packet capture tool that comes with iKuai, use the wan3 port to simulate the set-top box, and then capture the process of the set-top box establishing a connection for everyone to see. Because I use the wan3 port to connect to the optical modem iptv port of iKuai, it is very simple to capture packets. I directly specify the MAC address of the set-top box, so that irrelevant packets will not be captured, as shown below:
After starting packet capture, reconnect the wan3 port of iQIYI to initialize the authentication process, and then stop packet capture:
Click File Download to download the captured package to your local computer and open it with Wireshark:
From the Protocol part of the first five packets in the figure above, we can see that the DHCP authentication method is used. So what is the special part of this DHCP packet? You can see the three red boxes in the lower part of the figure above, which are the Host Name of option 12, the Client identifier of option 61, and the Vendor class identifier of option 60, as shown in the following figure:
Remember the parameters after Host Name in the figure above. The parameters after Client Identifier are the MAC address of the set-top box, and Vendor
Write down the value of the class identifier, this is very important. Chengdu Telecom is SCITV, but I am not sure about other places in Sichuan.
Option 12 does not seem to be necessary, so in order to pass IPTV authentication, the router's DHCP function must at least support option 60 and option 61. Both ASUS routers and iQIYI can support this function. ASUS routers only support option 60 and 61, while iQIYI supports option 12, 60, and 61.
ASUS Router:
iFast Soft Router:
So if you are using iKuai and happen to be using Chengdu Telecom (or Sichuan Telecom) IPTV, then congratulations, you can use one iKuai to surf the Internet and watch IPTV at the same time.
Finally, the parameters of my DHCP option are set as follows:
In the above figure, fill in the value you obtained by packet capture in option 60. For Chengdu Telecom IPTV, fill in SCITV. Fill in the value you obtained by packet capture in option 12 (do not fill it in for routers that do not support option 12, which does not seem to be necessary). For option 61, fill in the MAC address of your set-top box.
If the IPTV authentication in your area is PPPoE, it will be much more convenient. Just enter the username and password and dial. Anyway, as long as you can successfully obtain the IP address (not 192.168.xx, the address in Chengdu is 10.xxx), it means that you have passed the authentication of the Telecom IPTV end, joined the IPTV multicast group, and can receive IPTV packets.
Protocol conversion
The next step is to convert the multicast protocol packets into a format that can be played by "all media". In fact, there is only one key technology: udpxy.
The multicast packets of IPTV are UDP protocol. Udpxy converts the multicast packets of UDP protocol into HTTP unicast packets of TCP protocol. In this way, it can be played directly using http://soft router IP: port/multicast address: port. For example, the address of cctv1 here is:
http://192.168.1.254:55555/udp/239.93.0.184:5140
.
In iKuai, it is very simple to open udpxy, in "Advanced Application" - "UDPXY" settings - "Add":
Signal source interface, mine is wan3, so select wan3, fill in the service port at will, for example, I write 55555 here, and then there is an external network access. If you don’t have a public network address or have a public network but only want to access it at home, select "No" here, otherwise if you want external network access, select Yes, and finally click OK on the far right.
Obtaining multicast addresses for each channel
In the previous section, I mentioned that the address of local cctv1 after udpxy conversion is:http://192.168.1.254:55555/udp/239.93.0.184:5140
The first part of this link is easy to understand, but how is the last part 239.93.0.184:5140 obtained? Theoretically, this is obtained by packet capture and analysis. This should be the most time-consuming step of the entire solution, but because I have sorted out the program sources of Chengdu Telecom IPTV (some of them I think are not good have been removed, leaving 131), Chengdu Telecom IPTV friends are blessed. You only need to directly download the m3u file I use and then modify it slightly.
The text file in m3u format is similar to the following:
#EXTM3U name="Chengdu Telecom IPTV" #EXTINF:-1, CCTV-1 http://192.168.1.254:55555/udp/239.93.0.184:5140 #EXTINF:-1, CCTV-1 Dolby http://192.168.1.254:55555/udp/239.93.0.69:5140 #EXTINF:-1, CCTV-2 http://192.168.1.254:55555/udp/239.93.1.23:6000 #EXTINF:-1, CCTV-3 http://192.168.1.254:55555/udp/239.93.1.11:2223 #EXTINF:-1, CCTV-4 http://192.168.1.254:55555/udp/239.93.1.105:5140 #EXTINF:-1, CCTV-5 http://192.168.1.254:55555/udp/239.93.1.12:2224 :-1, CCTV-5+ http://192.168.1.254:55555/udp/239.93.1.36:8004 #EXTINF:-1, CCTV-6 http://192.168.1.254/udp/239.93.1.13:2226 #EXTINF:-1, CCTV- 7 http://192.168.1.254:55555/udp/239.93.1.67:5140 #EXTINF:-1, CCTV-8 http://192.168.1.254:55555/udp/239.93.1.14:2225 #EXTINF:-1, CCTV-9 http://192.168 .1.254:55555/udp/239.93.1.24:5140 #EXTINF:-1, CCTV-10 http://192.168.1.254:55555/udp/239.93.1.28:5140 #EXTINF:-1, CCTV-11 http://192.168.1.254:55555/udp/239.93.0.102:5140 #EXTINF:-1, CCTV-12 http://192.168.1.254:55555/udp/239.93.1.30:8124 #EXTINF:-1, CCTV-13 http://192.168.1.254:55555/udp/239.93.0.99:5140 #EXTINF:-1, CCTV-Children http://192.168.1.254:55555/udp/239.93.1.29:6000
The above part requires you to modify the router address, port and the last multicast address and port according to your own situation. At the end of this article, I will provide the m3u file of the Chengdu area. Friends who have Chengdu Telecom IPTV only need to replace it with the address and port of their own router. Friends in other regions can only find it by themselves. Anyway, it is better not to capture and analyze the packets by yourself unless it is absolutely necessary. Just search online to see if there is a ready-made one. If you really can't find what you want to watch, then talk about the way of capturing and analyzing the packets.
How to Watch
To be honest, after you have the m3u file, you can watch it directly, for example, you can use vlc player to open the m3u file directly:
However, it is relatively low-level. You can use vlc on Windows, but there is a better choice on Mac, that is APTV:
Isn't it a lot more advanced? The key is that iPhone, iPad, MacOS, and Apple TV are all corresponding versions, and they are synchronized through iCloud. Damn, this is the real full media playback. You can generate 2 m3u files for the intranet and the Internet, one for the device to use in the intranet, and one for the device to use in the Internet (replace the address in the intranet m3u with the Internet address. Of course, the home broadband needs to have a public IP and a dynamic domain name configured), and flexibly switch configuration:
To be honest, it’s mainly because I don’t watch TV, otherwise the experience of watching TV anytime and anywhere would be really great.
Another single client IPTV solution
In fact, before APTV, I was not very willing to use VLC or other players to open m3u directly, thinking it was too low-end. At that time, I used other methods to watch TV anytime and anywhere with a client, that is, the TV live broadcast function that comes with emby:
There are three benefits to this approach:
1. Through the emby client, iPhone, iPad, Mac, and Apple TV can play TV.
2. Support program guide:
3. Can record programs:
In terms of viewing experience, it is actually not bad, but every time I have to open emby first and then turn on the live TV, which is a bit annoying, so I have now abandoned emby and turned to APTV, although I still don’t watch TV, mainly because there is really nothing good to watch.
The download address of Chengdu Telecom IPTV program source .m3u is as follows:
关键不能回看拉动进度条
那是回放的功能了吧,这肯定是不行的,只能正常的看电视节目。