Sign in to follow this  
Followers 0

Air Tivi+, FRior, and the Streaming Service


36 posts in this topic

Posted · Report post

Like others, I have discovered that an iOS app called Air Tivi+ allows one to start the streaming service on the Miraclebox.

 

This service creates a .HLC folder in the default timeshift directory which contains an m3u8 playlist and incrementing segment files containing the stream content:

~ # ls -la /STORAGE/USB2/.HLS/
drwxrwxrwx    1 root     root         4096 Jan 21 20:20 .
drwxrwxrwx    1 root     root         4096 Jan 19 22:11 ..
-rw-r--r--    1 root     root          392 Jan 21 20:20 content.m3u8
-rwxrwSrwt    1 root     root      2320860 Jan 21 20:19 segment-000149.ts
-rwxrwSrwt    1 root     root      2317664 Jan 21 20:19 segment-000150.ts
-rwxrwSrwt    1 root     root      2320860 Jan 21 20:19 segment-000151.ts
-rwxrwSrwt    1 root     root      2320296 Jan 21 20:19 segment-000152.ts
-rwxrwSrwt    1 root     root      2318228 Jan 21 20:19 segment-000153.ts
-rwxrwSrwt    1 root     root      2320296 Jan 21 20:20 segment-000154.ts
-rwxrwSrwt    1 root     root      2318040 Jan 21 20:20 segment-000155.ts
-rwxrwSrwt    1 root     root      2320860 Jan 21 20:20 segment-000156.ts
-rwxrwSrwt    1 root     root      3088088 Jan 21 20:20 segment-000157.ts
-rwxrwSrwt    1 root     root      2321048 Jan 21 20:20 segment-000158.ts

Starting the live stream service is also acknowledged on screen:

 

egFyEB2.jpg?2

 

The generated content.m3u8 file can be opened in a desktop media client like VLC, or further transcoded, for example to broadcast the content to an RTMP endpoint such as an external live stream host, which is exactly what I am eventually trying to achieve. For example, here is the stream opened in VLC:

 

FuXXTAA.jpg

 

So, how does this work? The Air Tivi+ app description notes that it is compatible with devices which run FRior. Examining an open file handle in the .HLC directory shows us that they are modified by an application called /root/bin/app, which presumably interfaces with FRior:

~ # fuser /STORAGE/USB2/.HLS/segment-000062.ts -m
1465
~ # ps aux | grep 1465
 1465 root      169m S    /root/bin/app

This makes me wonder how we can work with the streaming service without having to use the Air Tivi+ application.

 

Invoking FRior application appears from /usr/local/bin appears to start a daemon process, but there is no activity on the Miraclebox, nor is the content within the .HLC folder updated. The manually called processes appear to persist until the box is rebooted (note that I did not start PID 1629 and I assume this was invoked by /root/bin/app or another process):

~/bin # ps aux | grep FRior
 1629 root      6284 S    /usr/local/bin/FRior
10460 root      6112 S    ./FRior -?
10466 root      6112 S    ./FRior -h
10476 root      6112 S    ./FRior
10488 root      6112 S    ./FRior --help

Another interesting note is that we must enter the IP address and username of the Miraclebox within the Air Tivi+ app for the live stream function to work. Could there be a specific port listening for FRior API requests on the device? Running an Nmap scan of my box shows several open ports, the only ones which would appear to require a username and password being the ports for ftp and telnet:

Starting Nmap 6.40 ( http://nmap.org ) at 2014-01-22 18:20 CET
Host is up (0.0061s latency).
Not shown: 995 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
23/tcp   open  telnet
80/tcp   open  http
139/tcp  open  netbios-ssn
8080/tcp open  http-proxy

Nmap done: 1 IP address (1 host up) scanned in 0.16 seconds

I wonder whether there is a way which we could monitor the calls made by the Air Tivi+ app on the box. There appears to be no command history logged on the box, thus I am wondering how best to approach this avenue of investigation.

 

Dumping incoming network traffic would be one option and sniffing for telnet commands might yield results, but without tcpdump installed on the Miraclebox device, this is probably better done on the router. Sadly, I don't have the means to do this at the moment.

 

I have e-mailed both Miraclebox and Octagon via their offical websites with these findings and questions, specifically how can we work with the live streaming service first hand, but received no response. Thus, I would welcome the thoughts of the community, especially if we can solve the mystery of FRior and give ourselves more control over live streaming on our Miraclebox devices :)

mauzer likes this

Share this post


Link to post
Share on other sites

Posted · Report post

For the past few days, I have been using the UDP streaming mode within the Air Tivi+ app, directing the output to one of my servers. This allows me to open the address udp://@:5004/ in VLC for a much more stable and better quality stream, following which I can issue an ffmpeg command to stream to an external RTMP endpoint of my choosing. However, I still have to use the Air Tivi+ application to change the channel I am streaming, which is very inconvenient, so I decided to pick up this investigation where I left off.

 

As the app description tells us, Air Tivi+ functionality depends on the FRior service, so I wondered what would change if I killed the FRior process on the Miraclebox device. Doing so closed port 8080 which we saw in the previous Nmap scan, and indeed once this port was closed and the FRior process was killed, the Air Tivi+ application stopped working. This led me to believe I was wrong to conclude that the app issues commands over Telnet.

As Nmap previously reported that port 8080 was a HTTP proxy, I decided to try scrutinise the traffic specifically routing to this port. I found an application called SquidMan which allows me to proxy my iOS device through my computer and monitor the network traffic between the two. After setting this up, I opened the Air Tivi+ app and monitored the traffic in the Console. Stopping and starting a channel stream revealed the following activity:

1390589811.503   2194 192.168.0.11 TCP_MISS/200 492 GET http://192.168.0.17:8080/frql? - HIER_DIRECT/192.168.0.17 -
1390589812.575   1016 192.168.0.11 TCP_MISS/200 492 GET http://192.168.0.17:8080/frql? - HIER_DIRECT/192.168.0.17 -
1390589814.829   2143 192.168.0.11 TCP_MISS/200 497 GET http://192.168.0.17:8080/frql? - HIER_DIRECT/192.168.0.17 -

These GET requests were intriguing, and visiting the URL shown returned a webpage containing these lines of XML:

<?xml version="1.0" encoding="ISO-8859-9"?>
<frior:query xmlns:frior="http://192.168.0.17:8080" frior:count="0" frior:created="2014-01-24T19:42:26" frior:version="1.2"><results/></frior:query>
<!-- frql.frior -->

This led me to believe that that SquidMan was not showing the full contents of the GET requests, given that all three lines shown in the SquidMan Console log when starting and stopping a channel did have an effect when triggered from the app, but manually browsing to the URL shown did not.

 

I then ran the same test again, this time capturing all traffic on my computer (including the SquidMan proxy) using tcpdump. Afterwards, I installed Wireshark in an attempt to inspect the traffic at a lower level. After setting a filter to show only the traffic going from my iOS device to the Miraclebox on port 8080, I was able to view the TCP packets in full. Starting a channel boiled down to this GET request, with the returned XML shown beneath:

GET /frql?cmd=start_streaming&sat_idx=98&svc_type=0&svc_idx=41&net_protocol=1&net_client_ip=%22192.168.0.2%22&net_client_port=5004&pin_code=%221111%22 HTTP/1.1
Host: 192.168.0.17:8080
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en-us
User-Agent: Air%20Tivi%20plus/1.1 CFNetwork/672.0.8 Darwin/14.0.0
Via: 1.1 localhost (squid/3.3.9)
X-Forwarded-For: 192.168.0.11
Cache-Control: max-age=0
Connection: keep-alive

<?xml version="1.0" encoding="ISO-8859-9"?>
<frior:query xmlns:frior="http://192.168.0.17:8080" frior:count="1" frior:created="2014-01-24T20:10:25" frior:version="1.2"><results><streaming error="0"/></results></frior:query>
<!-- frql.frior -->

This reveals that we can send the following HTTP request to start streaming a channel over UDP (to my selected destination of 192.168.0.2:5004):

 

Start Streaming:

http://192.168.0.17:8080/frql?cmd=start_streaming&sat_idx=98&svc_type=0&svc_idx=41&net_protocol=1&net_client_ip=%22192.168.0.2%22&net_client_port=5004&pin_code=%221111%22

When one wishes to call the start_streaming command to change the channel currently being streamed, an XML formatted error message will be returned unless the stop_streaming command is called first. This command is:

 

Stop Streaming:

http://192.168.0.17:8080/frql?cmd=stop_streaming

One of the most important variables in the start_streaming HTTP request is the svc_idx. This contains the ID number of the channel we wish to stream. We can issue a short command to return XML containing the channels available to us:

 

Get Channels:

http://192.168.0.17:8080/frql?q=svc_list

An example of the returned XML from this command is:

<?xml version="1.0" encoding="UTF-8"?>
<frior:query xmlns:frior="http://192.168.0.17:8080" frior:count="176" frior:created="2014-01-24T20:46:42" frior:version="1.2">
   <results>
      <sat idx="98" degree="0" name="Cable">
         <tp idx="2155" freq="4180" polar="1" sr="6875" tsid="48" orgnetid="40999" change_svc_possibility="1" streaming_possibility="0">
            <svc idx="99" type="0" sid="1025" vpid="4105" apid="4361" ppid="4105" scrambled="1" blocked="0" fav="0">
               <service num="100" lcn="115" encoding="ISO-8859-9">C More Fotboll</service>
            </svc>
            <svc idx="100" type="0" sid="1033" vpid="4097" apid="4353" ppid="4097" scrambled="1" blocked="0" fav="0">
               <service num="101" lcn="40" encoding="ISO-8859-9">TNT</service>
            </svc>
            <svc idx="101" type="0" sid="1037" vpid="4130" apid="4386" ppid="4130" scrambled="1" blocked="0" fav="0">
               <service num="102" lcn="64" encoding="ISO-8859-9">TV4 Guld</service>
            </svc>
            <svc idx="102" type="0" sid="1038" vpid="4147" apid="4403" ppid="4147" scrambled="1" blocked="0" fav="0">
               <service num="103" lcn="65" encoding="ISO-8859-9">TV4 Komedi</service>
            </svc>
            <svc idx="103" type="0" sid="1138" vpid="4103" apid="4359" ppid="4103" scrambled="1" blocked="0" fav="0">
               <service num="104" lcn="156" encoding="ISO-8859-9">Disney Junior</service>
            </svc>
            <svc idx="104" type="0" sid="1142" vpid="4102" apid="4358" ppid="4102" scrambled="1" blocked="0" fav="0">
               <service num="105" lcn="77" encoding="ISO-8859-9">C More Tennis</service>
            </svc>
            <svc idx="105" type="0" sid="1146" vpid="4112" apid="4368" ppid="4112" scrambled="1" blocked="0" fav="0">
               <service num="106" lcn="81" encoding="ISO-8859-9">C More Action</service>
            </svc>
         </tp>
         <tp idx="2159" freq="4500" polar="1" sr="6875" tsid="52" orgnetid="40999" change_svc_possibility="1" streaming_possibility="1">
            <svc idx="118" type="0" sid="1109" vpid="4130" apid="4386" ppid="4130" scrambled="1" blocked="0" fav="0">
               <service num="119" lcn="36" encoding="ISO-8859-9">BBC Knowledge</service>
               <evt id="44395" stime="2014-01-24T20:25" etime="2014-01-24T20:50">
                  <name encoding="ISO-8859-9">Bang goes the theory</name>
                  <text encoding="ISO-8859-9">Övrigt</text>
               </evt>
            </svc>
            <svc idx="119" type="0" sid="1023" vpid="4101" apid="4357" ppid="4101" scrambled="1" blocked="0" fav="0">
               <service num="120" lcn="10" encoding="ISO-8859-9" current="1">TV10</service>
               <evt id="3218" stime="2014-01-24T20:40" etime="2014-01-24T22:45">
                  <name encoding="ISO-8859-9">FA-cupen: Arsenal-Coventry</name>
                  <text encoding="ISO-8859-9">Fotboll/Amerikansk fotboll</text>
               </evt>
            </svc>
            <svc idx="120" type="0" sid="1075" vpid="4097" apid="4353" ppid="4097" scrambled="1" blocked="0" fav="0">
               <service num="121" lcn="70" encoding="ISO-8859-9">TV4 Fakta XL</service>
               <evt id="44300" stime="2014-01-24T20:25" etime="2014-01-24T21:00">
                  <name encoding="ISO-8859-9">Parkering förbjuden: Bärgarna</name>
                  <text encoding="ISO-8859-9">Dokumentär</text>
               </evt>
            </svc>
            <svc idx="121" type="0" sid="1053" vpid="4147" apid="4403" ppid="403" scrambled="1" blocked="0" fav="0">
               <service num="122" lcn="203" encoding="ISO-8859-9">Pink Plus</service>
               <evt id="58653" stime="2014-01-24T20:00" etime="2014-01-24T21:00">
                  <name encoding="ISO-8859-9">Sila</name>
                  <text encoding="ISO-8859-9">Serie/Drama</text>
               </evt>
            </svc>
            <svc idx="122" type="0" sid="1105" vpid="4102" apid="4358" ppid="4102" scrambled="1" blocked="0" fav="0">
               <service num="123" lcn="123" encoding="ISO-8859-9">BBC World</service>
               <evt id="41407" stime="2014-01-24T20:40" etime="2014-01-24T21:00">
                  <name encoding="ISO-8859-9">Africa business report</name>
                  <text encoding="ISO-8859-9">Samhälle/Ekonomi</text>
               </evt>
            </svc>
            <svc idx="123" type="0" sid="1110" vpid="4103" apid="4359" ppid="4103" scrambled="1" blocked="0" fav="0">
               <service num="124" lcn="204" encoding="ISO-8859-9">Channel One Russia</service>
               <evt id="43180" stime="2014-01-24T19:30" etime="2014-01-24T21:25">
                  <name encoding="ISO-8859-9">Novyj god</name>
                  <text encoding="ISO-8859-9">Nöje/Magasin</text>
               </evt>
            </svc>
            <svc idx="124" type="0" sid="1115" vpid="4104" apid="4360" ppid="4104" scrambled="1" blocked="0" fav="0">
               <service num="125" lcn="99" encoding="ISO-8859-9">Showtime</service>
               <evt id="43555" stime="2014-01-24T19:30" etime="2014-01-24T21:00">
                  <name encoding="ISO-8859-9">Mystery woman</name>
                  <text encoding="ISO-8859-9">Film/Drama</text>
               </evt>
            </svc>
         </tp>
      </sat>
   </results>
</frior:query>
<!-- frql.frior -->

Channels within this XML are grouped by their frequency, or as we should really look for, their streaming_possibility. If this variable is set to 1, we are able to initiate a live stream, thus in the example returned above, we would be able to send HTTP requests to start any of the following channels using the value in the svc idx variable with the start_streaming HTTP command: BBC Knowledge, TV10, TV4 Fakta XL, Pink Plus, BBC World, Channel One Russia, and Showtime.

 

This concludes my investigation into how the Air Tivi+ application and FRior streaming services work. I hope you found these posts informative and useful. I now plan to first write some scripts to automate these requests, and then a web UI which will sit on the Miraclebox device to emulate the functionality of the Air Tivi+ iOS app, specifically to control the current channel, the channel being streamed, and a YouTube/USTREAM style embedded flash applet to watch the streams from a webpage. I look forward to sharing these results as and when I have them :)

mauzer likes this

Share this post


Link to post
Share on other sites

Posted · Report post

Wow, thanks for sharing your investigation, this is really useful information!

Share this post


Link to post
Share on other sites

Posted · Report post

I configured port forwarding in my router, port 8080 TCP/UDP.

 

It works! You get the ability to stream live TV, review your timers and control your STB via a remote. 

 

My only concern is that the username and password apparantly are the same in every Fortis STB.

How can I change this in my box?

Share this post


Link to post
Share on other sites

Posted · Report post

This sound really interesting!

I hope more will come from this!

Share this post


Link to post
Share on other sites

Posted · Report post

I tried to stream from my box and it starts streaming but when I open a network stream in VLC on the target IP with udp://@:5004 it doesn't show anything. Tried the latest 2.1.3 version, and the Windows firewall is off. Anyone got it working with VLC?

Share this post


Link to post
Share on other sites

Posted · Report post

I got it working and can open the stream in VLC.

But it doesn't run smothly.

Even the TV start to stutter when I start the stream.

Does the box have the processor power to do this ?

It should work, there is no problem to stream a recorded program from the box to my PC.

Share this post


Link to post
Share on other sites

Posted · Report post

I got it working and can open the stream in VLC.

 

What VLC version and OS are you using? Any specific VLC plugin installed? I guess that you just chose open network stream and set stream as udp://@:port ?

 

I tried using latest 64-bit VLC (2.1.3) on Win64 doing that but the stream isn't showing up in VLC.

Share this post


Link to post
Share on other sites

Posted · Report post

What VLC version and OS are you using? Any specific VLC plugin installed? I guess that you just chose open network stream and set stream as udp://@:port ?

 

I tried using latest 64-bit VLC (2.1.3) on Win64 doing that but the stream isn't showing up in VLC.

I have VLC 2.1.3 Rincewind and 64-bit Win7. No plugins at all.

I just open network stream udp://@:25556 (I choose a port that I know is open for incoming traffic)

Share this post


Link to post
Share on other sites

Posted · Report post

Yep, that did it, I chose another port number so now I got it running as well.

 

I got the stuttering in VLC as well, changed the cahing value in VLC but that didn't help. No stuttering on the TV as far as I've seen.

 

As far as I can determine it has the processor power to do it. You can examine the procesor load by starting the streaming and then telnet into the box. If you haven't set a password it's root with an empty password. Then type:

 

/bin/busybox top

 

to run top in busybox. My readings are low (5 %) if I'm reading the correct one (CPU).

 

My guess is that it is some kind of incorrect setting in the box, it doesn't seem to send very much traffic so VLC might not have anything to buffer up.

Share this post


Link to post
Share on other sites

Posted · Report post

The stream returned from the Miraclebox comes in bursts so I guess that prevent VLC from buffering correctly. Tried looking around if I could find a way to change that behaviour but I haven't found anything useful.

Share this post


Link to post
Share on other sites

Posted · Report post

May have found something. If you monitor block I/O by using

 

/bin/busybox nmeter %b

 

block I/O may be hitting the roof, I don't know. It goes to 15k for me during streaming and back to zero when streaming stops. I just don't know what they mean by "block I/O". I can't really tell either if this is max on this hardware. The wierd thing is that if I make a recording to my NAS that doesn't generate any block I/O at all, but the recorded stream goes through the network as well.

 

Anyone with more details on this?

Share this post


Link to post
Share on other sites

Posted · Report post

My Frior version is 1.3 and RCU command keys seem different than in version 1.2.

Any ideas?

Share this post


Link to post
Share on other sites

Posted · Report post

My Frior version is 1.3 and RCU command keys seem different than in version 1.2.

Any ideas?

 

Using Miraclebox or other brand? Try contacting vendor for info.

Share this post


Link to post
Share on other sites

Posted (edited) · Report post

Does FRior come with standard FW or do you need the fortis FW? If standard, in which version is it introduced?

Edited by rawanimal

Share this post


Link to post
Share on other sites

Posted · Report post

I have similar problems on Windows XP and VLC - streaming using NetProtocol_hls is not smooth. But in the same network inviroment via Andoid phone and VLC it works perfect  :) .

But using NetProtocol_udp is not smooth on both. I think it is of old router...

Share this post


Link to post
Share on other sites

Posted · Report post

I see that Octagon has released a 2.11.87 which includes performance improvements for Tivi:

 

Changes for Octagon 2.11.87 in german:

--> YouTube Funktion verbessert.
--> YouTube Kategorien aktualisiert:
--> Top Rated, Top Favorite, Most Viewed Removed.
--> AirTivi+ Funktion verbessert.
--> Webzeal (WebBrowser) verbessert.
--> Sonderzeichen Fehler behoben.
--> Favoriten Zuordnung verbessert.
--> Media-Player Verbessert.
--> Diverse Korrekturen zur Verbesserung der Gesamtperformance

Do anyone know if a Miraclebox update is planned?

Share this post


Link to post
Share on other sites

Posted · Report post

Air Tivi+ (PC-programmet) har blivit en klar favorit under fotbolls-VM. Kan sitta vid datorn som har en TV som andra skärm och se på matcherna.

 

Har testat Android-appen lite gran också och den verkar fungera rätt OK.

 

Information om Air Tivi+ är svårt att hitta på nätet. Tiviar har nog sammanställt det mesta.

http://www.tiviar.com/airtiviplus.html

Share this post


Link to post
Share on other sites

Posted · Report post

Jag lyckas inte få det att fungera till min PC får inte upp någon kanallista. Ett felmeddelande visas "service Update failed"

 

Fjärrkontrollen i programmet går att använda

 

Någon som har en idé?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0