SurLaTablo.py - Python program to query and convert Tablo recordings

Almost sounds like a network/connectivity problem pulling the data from the Tablo.

I think I found the culprit – one of the recordings were corrupted, and I’m suspecting the HDD I’ve been using for several years now is beginning to die on me. Once I deleted that recording, the extract worked fine

Glad you found it. Unfortunately, as a “closed platform”, I can’t anticipate what kind of “errors” might happen.

I hope this isn’t a dumb newbie question, but…

I’m having an issue converting files using SurLaTablo version 2.3. The command line I’m using is:

surlatablo.py --noupdate --rec_id 45791 --convert --clobber

The .ts file seems to be created properly, but there’s an error in running ffmpeg against it. Specifically, this one:

[AVBSFContext @ 0x66737c0] Codec ‘ac3’ (86019) is not supported by the bitstream filter ‘aac_adtstoasc’. Supported codecs are: aac (86018)

Here’s a bit more context from the ffmpeg output:

Input #0, mpegts, from ‘/tmp/TablocTQy7u.ts’:
Duration: 01:01:16.03, start: 0.510522, bitrate: 6759 kb/s
Program 1
Stream #0:0[0x31]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x34]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
[AVBSFContext @ 0x66737c0] Codec ‘ac3’ (86019) is not supported by the bitstream filter ‘aac_adtstoasc’. Supported codecs are: aac (86018)
Error initializing bitstream filter: aac_adtstoasc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)

Note that on the Tablo (Quad) I have the “Surround Sound” option checked. Is there some option that I need to select in SurLaTablo to tell it that the source audio is ac3 rather than aac?

Of course, there are no “dumb” questions. I’m pretty sure I tested with surround sound recordings. I’ll double check that. I’m sure there’s a “solution”.

Try putting the following in your surlatablo2.conf file in your home directory:

TRANSCODER_OPTS['Mp4']['options'] = [ '-c:v', 'copy', '-c:a', 'copy' ]

Thanks - I’d managed to work around it by modifying the source and adding another profile (that I called Mp4ac3) that modified the options to what you mentioned, then changed the TRANSCODER_DEFAULT to Mp4ac3 in the surlatablo.conf file.

But that brings up another question - how to a change which transcoder to use from the command line without changing the default in the surtablo.conf file? It’s not obvious from the help info. I wanted to try the -z option with the MP4z transcoder, but I couldn’t figure out how to change to the MP4z transcoder from the command line.

Great job on this program by the way - it’s got great functionality and I love the search options and how integrated the metadata is in the final file!

You can always append new transcoders using the surlatablo2.conf file (so you don’t edit the source). Right now, that’s the best way to adjust the transcoder options.

Edit: To add a transcoder to the defaults add +Mp4zap1 (for example) on the command line to just do that “one”, leave out the + sign.

(the -z -z1 -z2 options are obsolete)

SurLaTablo is very configurable (I need to write a book). But version 4 will be very different. Likely 2 will continue to be supported even after 4 (python3 based) comes out (I’m adopting the odd number dev scheme).

yeah, yeah - a Book ! :slight_smile: !
I’m liking this quite well, since switching from tablo2go.

I’d say the only thing I miss is tablo2go’s “history” file that kept track of which shows had already been downloaded.
I have multiple TabloTV devices, and download them to different directories. I do this in case a show on one
TabloTV gets segmented, and the other does not. I can then look to see if I capture a whole show or not. So, when I get a complete show, I delete it from the broken directory, but don’t always delete it from the TableTV itself. Now when I run surlatablo again, it re-downloads the show.

It could just be that I haven’t configured it properly ???

SurLaTablo is pretty extensible. I can provide an “example” (that could be made much better) that shows how you could create a “transcoder” that actually writes to a log… and even a “transcoder” that reads the file and presents the data in a “pretty way”.

Consider (and this is not an ideal example) in your surlatablo2.conf:

LOGGING_FILE = 'SurLaTablo.log'
TRANSCODER_FUNCS += ['doLogging']
def doLogging(cmd_line,filename):
    now = datetime.now()
    date_time = now.strftime("%Y-%m-%dT%H:%M:%S")
    with open(LOGGING_FILE, 'a') as f:
      f.write("[{}] [{}] [{}]\n".format(date_time, filename, cmd_line))
TRANSCODER_OPTS['Logging'] = {
    'help': [ 'Log command to file' ],
    'command': [ 'doLogging' ],
    'options': [ ' '.join(sys.argv[1:]) ],
    'skip_ts': [ 'True' ],
    'ext': [ '.logging' ]
}

And then just add Logging as a transcoder to the command line or to your TRANSCODER_DEFAULT

So… why no “history” in SurLaTablo. Because it’s hard to know what exactly you wanted to do. SurLaTablo was designed to pull shows off with the idea that you are placing them somewhere. Perhaps multiple “somewheres” and perhaps multiple times. Originally, SurLaTablo did not have the “Delete” transcoder also. Anyway, I guess it’s hard to explain. Now, if SurLaTablo was a full on Tablo app replacement, then likely there would be a database since it’s a media engine as well.

Is there a way to use SurLaTablo to join together two recordings from the Tablo into one video? I’ve got a few shows where the recording was split (bad signal reboot, probably).

Well… unlikely today. If you coded something up as a transcoder, it would be weird.

But, the way my mind works, this could be something of interest (in general and not just in your particular situation).

Oh well. But I can use it to pull the two partials off, if I do it by RecID, right? Then I just need to join them some other way.

So, my guess (I don’t have bad reception anymore) is that you end up with two same named recordings with different rec_id’s?

So, let’s say the rec_id’s are 793869 and 793870.

Pull the second one (part 2) as a .ts file (using the Ts “transcoder”).

surlatablo.py -n -i 793870 -c Ts

Now, since these likely have the exact same friendly name, renamed the one just pulled. I like to pick on Judge Judy, so let’s say it ends up being: ./TV/Judge Judy/Season 23/Judge Judy - s23e169 - Judge Judy Sheindlin hears real cases. 2019-04-23 16:00.ts Rename that .ts file to part2.ts (or whatever).

Now retrieve the 1st file:

surlatablo.py -n -i 793869 -c Ts

Concatenate the two .ts files together. I use Linux… so a simple:

cd ./TV/Judge Judy/Season 23/
cat part2.ts >>Judge Judy - s23e169 - Judge Judy Sheindlin hears real cases. 2019-04-23 16:00.ts

Now… we have just a .ts ideally representing the recording we want. For this we use the somewhat secretive -T option. That instructs surlatablo that the .ts file is already present and to use it.

cd # back to home dir
surlatablo.py -n -i 793869 -T -c 

Note: subtitles aren’t going to work, so just a simply Mp4 this time around. Should be pretty fast since the .ts file was already there.

See if your Judge Judy episode (Judge Judy - s23e169 - Judge Judy Sheindlin hears real cases. 2019-04-23 16:00.mp4) is roughly what you wanted it to be!!

Thanks. I fixed the one that I had handy the harder way last night. That is, extract file, rename, extract second file, rename, use ffmpeg to convert and combine, then rename again.

I’ll try your method when I find another.

Did a couple more using your method. Quicker than what I was doing, but still kinda a pain. If there was a way to override the long path name on the initial extracts, then have it use the .ts file and save to the real path on the final command, then it would be really useful. And probably scriptable.

The -f option is supposed to be “the way”, but that’s not working quite right I’m afraid.

Does the season_number option only work for sports? I’m trying to use it for TV shows, but not having any luck. What would be a sample query line that would only get one season of a show?

Ah. Found it in a older post in this thread.

season_number is for supplying meta_data when there is none. Usually not a problem with most TV shows.

To query, you can use -q "The Series Name - s02e11" which ideally would find s02e11 of “The Series Name” show.

Whole season would just be -q "The Series Name - s02"