Saturday, October 30, 2010

XFS filesystem and Samsung LEDTVs

I've got a Samsung LEDTV, model UE40C7000W.Those new tvs can record and playback tv programs by connecting an USB flash drive. First time USB flash drive is attached, the tv requires to format the new drive.

File system used is XFS from Silicon Graphics (SGI). This filesystem seems was preferred due to high performance on video streaming and large files handling. Unfortunately windows operating system don't recognize this filesystem (but UBUNTU does!). The only software I've found to be able to read XFS partition on Microsoft Windows is UFS Explorer.

But... UFS Explorer is no free software and the freely downloadable version can recover only files < 64Kb... Sigh!

Some people says LLTools can read XFS partitions. Is no true! LLTools can read Linux Partitions (Ext2).

The drive formatted by led tv appears to be organized in only 2 folders: "database" (in lower-case) and "CONTENTS" (in upper-case). Recorded programs are placed into "Contents" folder. Each recorded program is made of 5 files, all named as YYYYMMDDHHmmss (timestamp of start of recording).  Some recordings have also a preview image in JPG format (but the file name is different).

The 5 files have different extensions:

.ckf -> ?
.inf -> a binary file with some informations about recording (title, channel etc)
.mdb -> ? (is no a Microsoft Office Access file!!)
.mta -> is an XML file Samsung calls SMVideoEngine (Samsung Metadata Video Engine)

Mta Files looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!--Samsung video metadata file generated by SMVideoEngine (Samsung Metadata Video Engine) v1.0, June 2009. (http://www.samsung.com)-->
<SEC:SECMeta xsi:schemaLocation="urn:samsung:metadata:2009 Video_Metadata_v1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SEC="urn:samsung:metadata:2009">
    <SpecVersion>1.0</SpecVersion>
    <MediaInformation>
        <VideoLocator>
            <MediaUri>file://samsung_content.con</MediaUri>
        </VideoLocator>
    </MediaInformation>
    <ContentInformation>
        <Chaptering>
            <ChapterSegment>
                <KeyFrame>
                    <InlineMedia>

[...a lot of alphanumeric chars...]

</InlineMedia>

                </KeyFrame>
                <MediaPosition>
                    <MediaTime timePoint="0"/>
                </MediaPosition>
            </ChapterSegment>
        </Chaptering>
    </ContentInformation>
</SEC:SECMeta>

.srf -> is the video file (finally!). GSpot says it is an MPEG2-encoded video but I think that's no true... In fact no software (VLC included!) can read this file! SGRUNT!

 I don't understand how jpg image is associated to recording... (into the .inf file? or into .mta or database?)

The "CONTENTS" folder contains also some other files like Timeshift (.inc, .mdb, .ckf).

The "database" folder contains only 2 files: ace.dat and ace.log. The two files are binary. Ace.dat starts with:
AceDB Created By Insun Kang, Young-Seok Kim, Kyoung-Gu Woo, Heegyu Jin, Kyung-Sub Min, Taewon Lee, Dongseop Kwon, KyungWha Hong, Shin HoChul, Ki Yong Lee, DongJin Choi, Ilhwan Choi, Dongjoon Hyun, Seokjin Hong, Ki Yong Lee, SangJung Woo, Hyoungmin Park, Chuho Chang

If you have some informations on:
  • how to read XFS partitions under Windows using a free software
  • the meaning/scope of files created by TV
  • how to read "ace" database
  • how to convert .SRF movie
please leave a comment.

35 comments:

  1. Hi,
    I'm searching over the internet the same informations. Have you found how to convert srf files to avi or something else?

    Thanks,
    RdP

    ReplyDelete
  2. I have made a simple test: record something on one TV, and put my USB stick on an other TV (identical model, different unit): the second TV refused to play the movie (it could see it, but not play). This means a very simple thing: the video files are DRM protected, and, will never be readable by anything else than the original TV.

    Reading those files thus, will be possible only in many years, when crakers will try to force reading using brut force, dispite DRM protection, a bit like we had to crak DVD to be able to read them on Linux years ago.

    For me it's a <>.

    This TV model is not frequent; and the probability to have a good craker work on this kind of file is very low. No hope for me.

    ReplyDelete
  3. Note that ... the main article could mention why XFS was a very bad choice: XFS is a high end server filesystem. XFS is discouraged for servers that don't have at least a UPS (ideally several ones). The FS does not accept a single powerfailure. Each powerfailure is subject to dataloss. And, when using it in 2003, while the FS was still beta, I even had a compleet filesystem loss (all partition was unmountable).

    Even if the actual stable version is more resistant, the use of this FS in a home TV, a device that is subject to home "ordinary" power, with powerfailures in winter, or when wind or storms ... is compleetely stupid. People, users, *WILL* report data loss, or disk erasure (TV will ask to reformat disk, or some files will fade away).

    I am writing a complaint letter to Samsung to report various problems, and I will have to mention this point also.

    ReplyDelete
    Replies
    1. This is really weird.
      XFS is a high end server file system dating back to '90s developed by Silicon Graphics. It was ported to linux in 2002, is natively 64 bits and is journaled (it can recover any interruption with all data available at the time of the crash or powerfailure).
      In line of principle there's nothing better for movies, just think to the file size limit of 8 exabytes (some 1000000 terabytes) that reduces to only 2 TB on old 32 bit linux distribution.
      Most of other filesystem (expecially FAT) are absolutely kids toys in comparison.
      You can mount the disk on any linux distro (I'm doing it now).
      The choice of using a 'strange' data format for videos is less nice but a converter is likely to be available soon.
      Looking at the files I see a db structure hosting all additional info on videos that is likely to speedup random access and searches.
      ... finally a good 'professional' job by a vendor.

      Delete
  4. @Freeman:
    Sorry... I've not find anything

    @DoubleHP:
    very interesting infos, thank you!

    ReplyDelete
  5. 1.In windows read XFS software ufsexplorer.
    2.Opening contejner SRF in program TSreader.
    3.Acronis true image home beckup XFS directory and extract the files to HDD.

    ReplyDelete
  6. @Ivo: ok but... How to read/convert the video stream?

    ReplyDelete
  7. After some search on SRF ... this blog is the only blog in the world mentioning that the SRF container can store video; all other people only speak about single pictures.

    I asked a friend if he could read the files; he works in a video lab; where they claim they can read anything; first time of their lives a file could not be read. The reason is simple: the Samsung TV accepts to record on disk only contents that have two requirements:
    - support DRM, called HDCP in the case of digital content (macrovision for analog containers like YUV); DRM is an optionnal support that can come in DVB, or HDMI (the TV can decode macrovision over YUV, for blueray readers using YUV, but the paper doc say it will refuse any non digital source for recording)
    - have some kind of "record enable" bit set to ON. DVB and BR content can prohibe recording.

    For any content where DRM is not supported, the TV will refuse recording: things like HDMI from a home computer, or any HDMI adapter (like SCART to HDMI).

    I have just roughly describe that the TV can show picture for more than a dozen of different technologies, but will accept to record only *ONE*.

    Samsung TVs are DRM oriented; so, when you see you can't even record pictures from PC, or VHS over SCART, i won't even dream about reading the SRF files. They are just encrypted with several levels of protections.

    The paper doc states clearly: if the TV is changed, or if the techs have to replace the motherboard, you will loose all your records. This format is officially designed to be read only by the unit where files were recorded. Even a twin unit can not read them.

    So, the only solution is: wait for some hacker to crack the stuff; we did it for DVD, which claimed to be secure; we always end in cracking things; but it could take decades. Every one could buy DVDs around the world; but owners of Samsung TV with PVR feature are quiet rare ... (even the shops which sell the unit just ignore the unit has a PVR inside !!! i tried to ask <> => <>, and after some search, they did have some ! )

    Really, the total amount of users in the world is too little; I have no hope enough crackers will work on this to get a crak in reasonable time (before my unit dies, less than 10y).

    Any linux live CD can read XFS; but for SRF, forget it.

    -- doublehp

    ReplyDelete
  8. Very good (but very sad!) job!, i agree this is the only web people talks seriously about xfs & srf files.

    Thank you!

    ReplyDelete
  9. for xfs access you can install vmware player, mount external hdd as "physical", load an ubuntu machine and browse this stuff. if you install vmware tools you can even drag+drop the files to windows. no point whatsoever when teh files are encrypted..

    ReplyDelete
  10. Hi,
    One thing which I have thought about it the fact that the SAMSUNG TVs run linux. So perhaps the recording/playback part of their Media@TV functionality is a piece of Linux software running on an ARM chip. It should be possibel (for a hacker type of person) to disassemble that software and get wiser.

    I find it too bad that:
    a) You cannot record sources which do not support DRM (See @Benoit-Pierre above). I would love to be able to record *anything* which I watch on my TV.
    b) I cannot take my recordings and play them back on for instance a PC when I go on holliday. Say I record a children channel for my kids and want to play them back when we are in a summerhouse on my portable PC.

    Well we just have to keep hoping for a hack to appear...

    ReplyDelete
  11. **** website, lost my message during auth

    ReplyDelete
  12. i restart, in short.

    There on market all in one chips, with memory, cpu, ram, from 3 usd, that you can not read. Even if you unsolder, open gently the plastic box, put in professionnal programmer ... you can not read the code in ROM, and can not read FLASH or RAM. All in one secured chips. Such chips are now in use in french credit cards since 2002 (other countries are following us).

    So, if I was asked and paid to develop similar TV that can encrypt and record on the fly, a way that files on HDD can not be read by other people, i really could do it easily. Just use a chip bigenough to encrypt on the fly, with private decypher keys inside the ROM, where the key is derived from serial number ... less than 5 USD per TV on the prod line.

    Even if you had access to the source code, private keys can be uniq per mobo, and unbreakable (strong RSA/SHA/MD5, something like 1024b up to 4096 can not be broken before 10^20 times the age of univers - unless using quantic computing wich won't be born before 2050).

    It's clearly stated, written explicitely in full letters in the paper doc: TV of the same model can not read your records. If for some reason you burn your motherboard and the manif has to change it under waranty, you loose all your films.

    The problem is that:
    - i did not have access to paper doc before i pay
    - it was the only cheap model with PVR in. So, even if I had found the doc online, i would not have the choice to buy an other model.

    Other PVR TVs start from 2000€.

    If they did things well, and, I believe DRM have been done seriously ... just forget it. DVDs was a peace of cake; passive media. DRM on active device is several scales better.

    ReplyDelete
  13. I think it's time to move this discussion to SamyGO Forum. Please visit:
    http://sourceforge.net/apps/phpbb/samygo/index.php
    (or samygo.tv)
    and discuss that problem with more people.

    BTW, the same problem with XFS partition and encoded recordings exists also in new Samsung PVR-ready blu-rays.

    ReplyDelete
  14. XFS is not a problem; the problem is that 94% people use Microsoft Windows, which sux, and does not support real FS (I will not quote the very long list of FS that Windows can not read). XFS is a technical solution. All real UNIX users can read XFS since ever (even my HTC G1 mobile phone can read XFS); it's a stupid choice for devices that do not have multiple redundant UPS, but it's a solution. The problem is DRM.

    ReplyDelete
  15. I'm working on this right now.

    CKF is the Content Key File.

    About the XFS partition is not a problem, I can redirect that on a remote drive easily.

    As far as I can see disassembling the firmware, CKF is encrypted using 128 byes (1024 bit).

    I have that key too.. any clue on how to use a 128 bytes binary key (rsa) to decrypt a binary file?

    ReplyDelete
  16. If the key is a certification file, it's just a signature so that the TV can know the disk was formatted by the TV itself.

    Assuming they have been impleneting DRM the proper way, you can not do anything with that.

    Once again, if things are done correctly, like in GPG or banking world, reading the movies will require a private key that is stored inside the ROM of TV, which is not stored on disk, and can be read only by hacking the TV the hardware way (unsolder the memory chip, break package, cut out the die, and re-wire the memory to a home made bus controller.

    A public certificate has no use.

    Brut force on movie content would be faster, as have been done for DVDs.

    ReplyDelete
  17. And do you know how to create a brute force script?

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. PVR Content Decrypted (srf file) , Check SamyGO forum for more details.

    ReplyDelete
  20. After a glance, yes there is a post about SRF decyphering, and it seems to work as I thought: brut forcing (it seems to be comparing source encrypted file, with raw output to reverse engineer the algo, and deduce private key from comparing encrypted text against clear text - easy method when you have access to some decoder). Does not look like an hoax.

    I will give it a try when I have some time.

    ReplyDelete
  21. Astonishing... I'll be waiting the good news.

    ReplyDelete
  22. Hi, sorry for my ignorance,any suggestion on wich course should I subbscribe to understand what you are talking about? I solved the problem recording on a dv cam, but I'd like to learn. Programming? electronic engeneering? c++? Python?
    Thank you

    ReplyDelete
  23. I have the same questions. It would good if one can covert the recorded tv programme from Samsung LED TV XFS format to ordinary AVI format

    ReplyDelete
  24. SPH ... your querry is irrealistic. XFS is a file system; AVI is a stream container. The later is to be stored inside the first one ...

    You can produce AVI files by using Mencoder. You can not convert XFS directly, you have to copy files to an other disk or partition before re-formating.

    XFS is not an issue (at least, not for UNIX users); SRF is not an issue either; the issue is not in reading the SRF (neither the file on disk, or the file streams); the only issue is about decoding the stream inside the SRF: getting the DRM private keys, and decypher the frames.

    That's the aim of SamyGo.

    Using AVI to store it would be a stupid idea anyway; MKV is way more flexible.

    Your question is the proof you don't understand what we are talking about.

    There is a side issue about XFS, but it's offtopic. XFS is a journalised FS, but the journal have been designed to boost operation, and only increase performances ... unlike ext3/ext4 which are designed to endure powerfailures, and allow quick filesystem checks over large disks and recover broken files which were being written at the moment of power failure. On powerfailure, files being written on XFS are likely to be lost; usually completely lost. If you have a powerfailure during a movie rec, you are very likely to loose the whole movie; if Samsung were using ext3, you would have at least the begin of movie. This is an issue for me this week: my external disk is getting unstable: every time the disk disconnects, I loose completely the movie I am trying to record. XFS is heavily discourage on USB disks and workstations that don't have UPS.

    ReplyDelete
  25. Hi everyone,

    I think here is one new thing.

    Recently I have bought Samsung TV, UE32D6500. I have made an firmware upgrade, so I believe I have got the newest one.

    After making some video recordings on USB memory I have found additional file with ".enc" extension (besides .ckf, .inf, .mdb, .mta, .srf). Every "*.enc" file has 44 bytes length and differ from other ones by 6 bytes.

    What do you think about it? Enc - encryption?
    What for is this file?

    ReplyDelete
  26. use ufs explorer and destroi.

    http://wiki.samygo.tv/index.php5/Desktop_applications_list#DeSTRoi_-_Decrypt_Samsung_TV_Recordings

    ReplyDelete
  27. The download link on this page is dead.

    ReplyDelete
  28. Well i manage to see on my Pc(windows 7) my recordings from Samsung series C.
    Just boot in suse live usb, recognize the files from samsung copy them to another usb stick , then reboot into windows and with Destroi app decrypt like a charm!!!
    Downloaded from here:

    http://forum.samygo.tv/download/file.php?id=1182

    ReplyDelete
  29. Hi everyone,

    Is there a linux version for DeSTRoi or alternative application?

    How I can edit the generated videos? Normally I used Avidemux but it doesn't work well with them. It's seems to be a problem with the video header.

    $ avprobe 20120907202400.ts
    avprobe version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2007-2012 the Libav developers
    built on Jun 12 2012 16:52:09 with gcc 4.6.3
    --------- This fragment is repeated five times. --------------------
    [h264 @ 0x23bfe80] non-existing SPS 0 referenced in buffering period
    [h264 @ 0x23bfe80] non-existing PPS referenced
    [h264 @ 0x23bfe80] non-existing SPS 0 referenced in buffering period
    [h264 @ 0x23bfe80] non-existing PPS 0 referenced
    [h264 @ 0x23bfe80] decode_slice_header error
    [h264 @ 0x23bfe80] no frame!
    --------------------------------------------------------------------

    [mpegts @ 0x239d9c0] max_analyze_duration reached
    [mpegts @ 0x239d9c0] PES packet size mismatch
    [mpegts @ 0x239d9c0] PES packet size mismatch
    Input #0, mpegts, from '20120907202400.ts':
    Duration: 04:47:19.78, start: 23691.007778, bitrate: 15 kb/s
    Program 342
    Program 343
    Program 344
    Program 1059
    Program 1064
    Stream #0.0[0x1f5]: Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 50.83 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x1f6](spa): Subtitle: [6][0][0][0] / 0x0006
    Stream #0.2[0x1f7](spa): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
    Stream #0.3[0x1f8](mul): Audio: mp2, 48000 Hz, stereo, s16, 96 kb/s
    Unsupported codec with id 94215 for input stream 1

    With HandBrake I can convert them but not edit them.

    ReplyDelete
  30. This comment has been removed by the author.

    ReplyDelete
  31. Decrypting solution .SRF to .TS: DeSTRoi 1.3.3

    I tested PVR files (SD & FullHD recordings) extracted from my UE55D8000, and got 100% successfully! The decrypted output file (.ts) playable with Media Player or VLC (+enable deinterlacing)! Before this, need a UFS Explorer, or Linux with XFS support to extract all files from PVR HDD. No need to key extraction, or key attack...
    (Tips: Set Output folder, before start Decrypt :):) I sucked with this :))))



    Download:
    http://forum.samygo.tv/viewtopic.php?f=48&t=4706

    Don't work with series "E"!

    (My TV is factory original, not hacked with SamyGO.)

    Sorry for my bad English... I hope, you understand Me.

    ReplyDelete
    Replies
    1. Thanks Tibi, DeSTRoi 1.3.3 works fine for me. I tried under Linux with Wine, used WineTricks to install .Net4, but destroi refused to start. Under Windows XP I had to install many components, Destroi really needs a lot of stuff to run, but it did the job. I could export many .SRF files to .ts. As Tibi said, there are tricks to get it work. First, set the output folder; if left by default, or set to Desktop, the app will decrypt, but won't write anywhere; and of course won't produce error message. Then, you can play with the MDB/DRM menu, does not impact. What is very important for me is to leave AF option unticked. If ticked, Destroi will export, but output file is not readable by my players.

      Reading files from the TV and XFS stuff is completely offtopic.

      Delete
  32. To read XFS under windows, use free Crossmeta: http://www.crossmeta.org/redmine/projects/crossmeta/files
    1.After installation, start services:
    net start cxvfsmgr
    net start xfs

    2.Set Path and check device names:
    set path=%path%;v:\bin
    V:
    cd V:\dev
    dir

    3.Mount the device and access files:
    mount -t xfs /dev/da1s1 /mnt
    cd V:\mnt

    ReplyDelete