Altibox

Altbox is a norwegian TV/Internet ISP offering Internet and TV access home, inkluding some video-recording devices.

Those boxes can be accessed and the recorded Movies extracted and taken as backup.

Harddisk

The recording boxes have a plastic cover on the lower side that can be opened without any screwdriver and the included harddisk been taken out. In my box at home it's a Toshiba drive with 500GB.

With a disk adapter the drive can be attached to any system.

fdisk shows the system as linux drive:

Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device    Boot Start       End    Blocks  Id System
/dev/sdb1         63 976768064 488384001  83 Linux

File structure

Mounting the drive as read-only (just for precautions) the following file structure appears:

$ mount -t jfs /dev/sdb1 /mnt/disc -oro
...
drwxrwxrwx 4 1011 root   48 2015-09-28 22:35:03 +0200 asset_aYNNX0
drwxrwxrwx 4 1011 root   48 2015-05-12 00:20:02 +0200 asset_Bbw5VI
drwxrwxrwx 4 1011 root   48 2015-05-02 20:40:04 +0200 asset_Cp2axP
-rw-rw-rw- 1 1011 root 275K 2015-09-30 19:09:21 +0200 assetdb.db
-rw-rw-rw- 1 1011 root 275K 2015-09-29 23:37:41 +0200 assetdb.db.1
-rw-rw-rw- 1 1011 root 275K 2015-09-28 23:37:25 +0200 assetdb.db.2
-rw-rw-rw- 1 1011 root 275K 2015-09-27 23:37:08 +0200 assetdb.db.3
drwxrwxrwx 4 1011 root   48 2015-03-06 14:45:04 +0100 asset_ZxhczG
drwxrwxrwx 2 root root 4.0K 2015-09-28 22:35:03 +0200 latens
lrwxrwxrwx 1 root root    1 2000-01-01 01:01:06 +0100 reserved -> .
drwxrwxrwx 2 root root    1 2000-01-01 01:01:06 +0100 temporary

asset_xxxxxx

These are the directories containing the recording.

assetdb.db

A sqlite3 database with all informations about th recordings, inkl. name, time, etc.

the rest

I didn't care about. latens has probably something to do with the recording of whole series, but I did not have a closer look at that.

Folder structure

The directories named asset_xxxxx contain the whole recordings, but not as ready named file and splitted into smaller pieces. A random picked folder has a structure like this:

$ ls -l
total 8
-rw-rw-rw- 1 root root 227 2015-07-26 17:58:57 +0200 build_data.xml
drwxrwxrwx 2 root root   8 2015-07-26 17:58:58 +0200 index
-rw------- 1 root root 258 2015-07-26 18:10:02 +0200 info
drwxrwxrwx 2 root root  32 2015-07-26 18:07:49 +0200 stream

build_data.xml

This file contains some information of the time of the recording and the version of the recording box. Nothing useful for my purpose.

index

No idea what this does

info

A file containing some weird stuff. Not useful either.

stream

This is a bit more interessting. This folder has all the recording files splittet in chunks and named: chunk_x.

$ ls -1 stream/
chunk_0
chunk_1
chunk_2
chunk_3

Those files are encoded with h264 (video) and ac3/mp2 and can be simply concatonated:

Less than 10 files:

cat chunk_* > ~/outputfile.mp4

Database

The information about which series is in which folder is placed in the file assetdb.db. This is sqlite-database.

The internal structore of the database is not very complex:

sqlite> .databases
seq  name             file
---  ---------------  --------------------
0    main             /mnt/disk/assetdb.db
sqlite> .tables
AssetInfo           Directory           Property
AssetLink           Location            PropertyDefinition
AssetLock           MountedAssetInfo    _Metadat

The interessting table here is called Property This table contains the location and some other metainformation about each recording.

CREATE TABLE Property(PropAssetId TEXT NOT NULL CONSTRAINT PropAssetIdForeignKey REFERENCES AssetInfo(AssetId) ON DELETE CASCADE, PropKey TEXT NOT NULL, PropValue TEXT NOT NULL, PRIMARY KEY(PropAssetId, PropKey, PropValue) );

The field PropAssetIdForeignKey contains the folder name (asset_xxxx), Propkey can have different values:

  • Date
  • ProgrammeName
  • Description
  • ...

The date, name of the programm and/or the description is enough to identify a recording.

Armed with that information we can now extract the folder name for a specific recording, which can be identified by the date and the name of the recording:

sqlite> select PropAssetId,PropKey, Propvalue from main.Property WHERE PropKey='ProgrammeName' or PropKey='Date' ORDER BY PropAssetId;
asset_0rnX1D|Date|2015-09-10
asset_0rnX1D|ProgrammeName|RÃ¥skap
asset_0wEr8l|Date|2015-09-26
asset_0wEr8l|ProgrammeName|Stjernekamp
asset_18wQyK|Date|2015-05-24
asset_18wQyK|ProgrammeName|City Of Men
...

Following those paths in the root directory of the disk we find (as mentioned above) the recording in the subfolder stream. The Movie City of Men is in this case in the directory ./asset_18wQyK/stream/.