Extracting Videos from Tablo External Hard Drive

In case someone has an old external hard drive from a failed Tablo with videos they need, or you are just interested in sample queries of the Tablo.db… I pushed my Python 3 script to make an .MP4 file from the video segments to github. Obviously if your Tablo is working there are many better ways to do this with apps listed here! But, if the Tablo is dead, this might help save some videos.

I only use Linux, but the DB Browser program I used to query the database is available for Windows and Macs. Python Version 3 is needed and enough skill to change two variables in the code.

I used this to pull videos from a four year old drive (old firmware) and the latest 2.2.30 firmware.

1 Like

Thanks greatly! Now to get tablo to update this, the /DB on disk routinely. As far as we know, it’s only done when you press/tap the blue button for reboots.

In the unlikely event your tablo has a fatal hiccup, if this was updated via maintenance mode, even weekly, you’d have a fresh DB copy to salvage your recording. Of course, they don’t plan for failure. :neutral_face:

just a note, Backup-tablo.sh does backup the /DB directory as well, it’s not selective, it backs up the entire drive nor does it “export” recordings.

Yes, in order to have an up-to-date Tablo.db the reset button has to be pressed, then the reset has to complete. Just running the Backup-tablo.sh bash script will not ensure a current Tablo.db. As you say, if the /DB folder were updated during the nightly maintenance mode that would be really good!

But, it works, even if you have to browse around for the folder – if the database is not current. I teach Python with Qt, and it is on my list to create a GUI version with a tableView widget that shows the Recordings table, but then again, they might decide to change the database structure, again. The Recordings table did not even exist in the older firmware… Just showing the queries and the ID is probably safer long-term.

Might it be that that to update the DB requires that there be no activity that involves the DB. Maybe Live TV and recordings would be prohibited(blown away) during this time.

And none of this activity occurs during bootup.

I believe it actually occurs during shutdown, and is read upon boot with a new (or factory reset) device.

Correct, just pointing it’s a way to access it without disconnecting the drive and/or have a copy - but outdated is somewhat pointless.

This is much better than - Recovering Show from good drive/dead tablo, but if the DB is too outdated and you just gotta, this is a last resort attempt. I just tried to show it works, not recover many several recordings.

Thanks again. I only know enough to brows the DB… it was more than I needed to know to dig into it. :slight_smile:

As far as I know tablo doesn’t have an actual shutdown button. The reset button seems to take affect immediately and perform a soft reboot.

Many users probably don’t feel like fiddling around with the little blue button and just pull the power cord. These people would never have a “valid” DB.

And just what is the DB on the actual disk for? Is it a real time DB or is it just a check point instance used for something else? Could it be for recovery or disk migration?

The Pixelworks CPU comes with all the software to implement tablo base DVR capabilities. It comes with the OS, drivers, SDK, API, and the software stack. And if I remember correctly it’s the LAMP software stack. This stack includes the MySQL database software. And if the tablo unit comes with on board flash, would one expect that the MySQL database is on the USB disk which could easily crash or be removed.

Doesn’t a soft reboot shutdown a system before restarting? Does it really just completely stop almost like pulling the plug? Then, restarts?

Hopefully very few users will need this.

It used to migrate you drive to a new tablo, or for one, to swap drives.

Hello! I’m glad someone has worked on a tool to recover recordings directly from a Tablo drive. I lost my DB when trying to migrate my drive to a new Tablo and now I have 3TB of recordings in Limbo (cannot be played by Tablo). I will try to use your scrip in Ubuntu to recover at least the most important recordings (if I can identify them). I’ve never worked with Python scripts but I should be able to copy/paste terminal codes… I will give it a try later tonight and see if I get somewhere!

Just to note, in his third post - you need the /DB in tact for this to work! If you have this, you should be able to “migrate to new tablo”.

In other topics you comment you think you new device wiped out the settings but left the recording files… this seems odd, but maybe. You needed to tap the blue button before removing the drive from your old device to create the /DB, this is an important step.

As long as you didn’t reset your old device any/or leave it powered up, everything should be intact and you can (or should be able to) still do this again. Everything on the old device should still be just like you left it as long as it didn’t go through any overnight maintenance.

@djk44883 That is incorrect, the only thing the /DB provides is the information about the recordings. The utility can still be used to make .MP4 files from any of the recordings so long as the /REC folder is still available.

Comments in the Python script provide sample database queries so that a person can determine which recording(s) to recover. Obviously the person with 3TB of recordings would have a lot of videos to watch to determine the title of the show / movie and the date, etc. without the the DB. The DB provides the metadata for the recordings. The utility just requires the recording ID which is just a number used to name the folder containing the individual segments of the recording.

I’m starting to explore and see if I’m able to use your script. I’m currently using Ubuntu 20.04.2 LTS and I’m reading your script to try to understand. I’ve installed FFmpeg, Handbrake and DB Browser for SQLite from Ubuntu Software. I’m trying to open the Tablo.db file with DB Browser for SQLite and I get a message " Could not open database file. Reason: file is not a database ". Am I using the right DB Browser software or am I doing something wrong?

I was trying to open the Tablo.DB file in a folder named “db_backup_2021-03-31_21.45.31” which indicated the date before I couldn’t play my recordings but DB Browser for SQLite says the file is not a database. Maybe the file is corrupted and that’s why I got the problem.
DB Browser is able to open the file Tablo.DB inside folder “db”. I’ll try to find the metadata in that DB.

I copy/pasted the database sql query on DB Browser and it’s working! I get a list of about 1400 recording info, including the “objectID” required to identidy which folder number contains the recording I look for. Tomorrow I hope to keep making progress and hopefully I’ll be able to extract my recordings! :smiley:

@characato glad you found the correct version of the Tablo.db.
As I am sure you know, it will be a long process to individually build that many recordings!
The Tablo.db structure has changed over the years. I considered making a PyQt5 GUI app to allow recovery, but the structure could change again tomorrow, rendering that work useless. Regardless, at least you have some path forward.

1 Like

Ok! I succeeded running the script and I got an mp4 file for the recording I selected. It took some seconds to do it!

I had to install ffmpeg from the Ubuntu Terminal because it couldn’t find “ffprobe” (I had installed ffpmeg grom Ubuntu Software before). Then I got a message saying the file directory didn’t exist or something like that. So I went to /root and created a folder named “Videos” and then it worked fine.

However I get a file named “1332466.mp4”. So it’s the folder ID. It would be awesome if the script could look into Tablo.DB, extract the recording info and include the metadata in the output mp4 file (the minimum info for Plex to process it). That would save a lot of time in manually renaming the mp4 output files.

Thanks a lot for the script @ken_clifton !

I realize it’s a rescue script, but I thought that was the purpose of the script, extracting the Show with the IDs… which is does, but then you have to put in the ID, and it won’t extract the Show title, nor allow you to enter a name for the show?

Again, it’s likely meant as a way to rescue show from a last resort before loosing everything - it works!

1 Like

Glad you were able to recover one @characato . I put the code out on github as soon as I had something that worked for me in case someone else was faced with losing all their recordings. The thought and hope was “something is better than nothing.”

This summer when I am not faced with the demands of teaching programming I will create a readme file for the script on github, noting some of the prerequisites for it to work.

Regarding the comments about using the database, keep in mind that there is absolutely no guarantee that the database will be present on the hard drive. Also there is no guarantee if the database is there, that it is current. This is documented many times in the Tablo Community. Odds are you will have recordings in the /REC folder that are not in the database depending on when the database was last manually saved.

I am sure you read my earlier comments regarding the structure of the Tablo.db changing periodically. I agree it would be nice to have the utility query and include the information, just remember that whatever worked now, might not work a year from now.

Thanks for sharing your recovery experience. I am still personally amazed that so many individual segments can be successfully reassembled into a functional MP4 and that I got it to work with varying recording quality as well.

1 Like

Yes, you provide the folder ID and it automatically names the output file “video_folder_ID.mp4”. I may try to edit the script adding a 3 variable “filename_ID” and change a couple of lines so it names the output file according to the 3rd variable. It may not work since I’m quite a newbie with python but I think python code seems not too hard to understand.

I tried and it worked. Pretty cool! I like this script!

I see, you have to edit it each time, as noted, it’s sort of a last resort rescue - and it does what you need it to. Great work.

I believe it needs video_folder_ID = "791164" so it knows where to find the *.ts Maybe tweak and add something like ShowNane="Name Of Show" or file_name="Name of Show after and change line 139 - part of the ffmpeg command, note: if you’ve added a line it’ll be line 140

"-y", pathlib.Path.home().joinpath("Videos", (video_folder_ID + ".mp4"))

changing video_folder_ID to your file name variable

"-y", pathlib.Path.home().joinpath("Videos", (ShowName + ".mp4"))

Now, need some for in shell script (maybe even better options) to pass several IDs and show names at a time to the py script, maybe run batches of 5, 10, 25 if things go well. That’s going to tedious and all ding-dongs!