Monday 28 April 2014

Converting PVR files to a NAS drive.

Akai AD185X High Definition Set Top Box

The Akai AD185X High Definition (HD) set-top box (STB) converts Digital TV into an analog TV format.

A bonus feature is that it can also save the Digital TV programs to an external USB drive so you can defer watching your programs. At the time PVR's were expensive so the STB looked like a cheap alternative especially if you had a spare USB drive lying about.

Background

The PVR function stores the files on a FAT32 or NFS file system in a *.ts (transport stream)  format. The Fat32 file system can only support files of up to 2G bytes. The length of your recording will determine how many 2Gb *.ts file chunks are generated. Each recorded program is stored in its own directory in *.ts format with enough file chunks to record the program. As I didn't want file chunks on my NAS drive I needed to create a single file that represented the stored program then a format compatible with the media streamer.

What is TS?

TS stands for Transport Stream. This video file format is a part of the MPEG system, which is the reason why it is also called as MPEG-TS. Aside from the usual audio and video formats embedded in its file system, it also contains PSIP data. PSIP means Program and System Information Protocol. It is the protocol that allows video files capable for broadcast or transmission purposes.


Being developed by Moving Pictures Experts Group, the TS video file system adheres to the ISO standard. It is also alternately referred to as MPEG-2 Part 1. The format also supports stream synchronization and error correction whenever the transmission signal becomes degraded.

TS vs AVI

The major differences of AVI and TS video files lie in their actual use. TS files are primarily for video streaming purposes as such a feature is not supported by the AVI. However, the main use of AVI is for playing movies on a disc. Unlike the TS file format, it can support chapters and subtitles embedded in its file system. TS files don't have this capability.

Create a single file

The 2G byte file chunks need to be merged into to a single file.

Using Linux I used the cat command to concatenate TS files together.
Using Windows I used the copy with the '/b' switch to concatenate TS files together.

Both methods were useful in concatenating the file chunks into a single file then determining that the single file was also playable.

From my point of view I didn't want to create a GUI "shell script", so I wrote a Java application to concatenate the parts into a singe file.


The Java program would accept drag and dropped files onto the app and save the resultant file in the same directory as the chunks.

A nice feature was to have a progress bar showing the progress of the operation.



Convert the video file to a compatible NAS Format

My NAS also served the files using the CIFS (samba) file system.

I could mount the files on my windows system as a network drive.

The program Simple Video Converter 1.5. is a  frontend for mencoder for Windows and Linux. 
It converts rmvb,avi,mp4,wmv, ogv, mkv, mov, mpg, vob,ogv, ogg, ogm etc to avi (divx5), xvid, dvd iso, h264 in a simple way.

I was able to take the single chunk video file and convert it to an AVI file which was compatible with my NAS Server.

The program would collect a set of files and batch them all to the video directory from my windows directory.

The program was fast efficient and it works but best of all its free!

Conclusion

Quite a convoluted process to generate NAS friendly file on my NAS drive but doable. Some of the gotchas I discovered:
  • uPNP does not lend itself to be discovered when when being accessed via a VPN (IP multicast has issues)
  • Some settings related to network discovery are enabled, but not all of them. For example, network discovery could be turned on, but you or your system administrator might have changed firewall settings that affect network discovery. Network discovery requires that the DNS Client, Function Discovery Resource Publication, SSDP Discovery, and UPnP Device Host services are started, that network discovery is allowed to communicate through Windows Firewall, and that other firewalls are not interfering with network discovery. If some but not all of these are true, the network discovery state will be shown as Custom.
References:






No comments:

Post a Comment