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


#647

@cjcox; with regards to commercial zapping, would there be an easy way to do some sort of video fingerprinting to help improve the accuracy of commercial identification?

If there is, it might be an idea to use the black frame technique to identify cut points and generate fingerprints for any segment small enough, then have the end-user say if it is a commercial or not. Use the fingerprints in the future to identify and remove the commercials. It would require regular user interaction (every time there are new commercials) but would provide a better way to cut down on false positives.

I have no idea how hard it would be to implement. I’ve never even looked at video fingerprinting beyond knowing it exists.


#648

The problem is determining where a show and commercial break exist. Sometimes the transition amounts to a fade which is pretty much the same as a normal scene to scene fade inside a show. The other elements that are commonly used is audio and watermark detection. The combination of black frame detection, audio difference detection and watermark (that network symbol in the corner or tv rating) are the common ways of trying to deduce a commercial break. SurLaTablo only does black frame detection.

However, I have pointed out that for commercial cutting a crowd voting mechanism might be possible… and I think that’s what you’re hinting at… there’s comments I believe in this forum about that…

But, IMHO, the human eye can make the decision pretty quickly if shown choices on a screen. There’s a tool still locked inside my brain that will do this. Thus commercial zapping (cutting the commercials out) will likely belong to that tool. And again, I’ll probably take SurLaTablo 3 to chapter markers.


#649

I added the snippet for my customized ffmpeg parameters. It does the following:

  • Engage h.265 codec at a bit rate of 650K

  • Converts all video to 24 (actually 23.976) creating a ‘cinematic’ look and lower BW

  • Uses AAC audio codec (requiring ‘-strict -2’ to be passed to ffmpeg)

  • embeds the .srt file into the movie file. I use .mkv extension. Other extensions can’t hold subtitles

  • label’s the converted file (with extension) as “???-5.mkv” to show it’s my parameters

  • Lastly, in a later segment of the code, delete the now unnecessary .srt file

              'Mp45': {
                  'help': [ 'Custom conversion of video and audio from Tablo .ts to .mp4 with embedded srt.' ],
                  'command': [ FFMPEG ],
                  'threads': [ '-threads', '0' ],
                  'inputfile': [ '-i', '${ts_filename}' ],
                  'subtitlefile': [ '-f', 'srt', '-i', '${srt_filename}' ],
                  'options': [ '-vcodec', 'libx265', '-b:v', '650k', '-r', '24000/1001' ],
                  'subtitleoptions': [ '-c:s', 'copy', '-metadata:s:s:0', 'language=${lang3}' ],
                  'audiooptions': [ '-acodec', 'aac', '-strict', '-2', '-metadata:s:a:0', 'language=${lang3}' ],
                  'metadata': [],
                  'ext': [ '-5.mkv' ]
              },

#650

Just an fyi, the reason why the Mp4 (and others) not only embed the srt as mov_text but also include the .srt is because Plex can sometimes make sense of the embedded subtitles and sometimes not. It used to be an option to preserve the .srt, but I made it the default because of this problem.

See:


#651

It’s been a while since I did my research. My memory tells me that subtitles aren’t possible in .mov, which is why I had standardized on .mkv. I could be wrong about it. I have strong faith in my current system of embedding into .mkv that I automatically delete the .srt files. Nice and tidy :slight_smile:

BTW, love the DeleteX feature. I don’t have enough faith, YET, in my system to automatically delete the recordings, but I’m getting close :slight_smile:

allen


#652

Forgot the reason I came here today: TABLO wants to update to 2.2.16. I’m running version 2.0 of surlatablo. Are they compatible?


#653

Don’t confuse mov_text with mov. It’s just what is known as embedded subtitles.

Oh… and my personal option is to NOT add the DeleteX. I prefer to know my extractions are sane before removing.

Example: I pull a movie off a 480 resolution channels and they are showing it letterbox (like many movies on the MOVIES! channel) and I used the default Mp4 transcoder instead of Mp4W, so I want to pull and do it right. Can’t do that if the info is deleted.


#654

No problems with 2.2.16 that I know of.


#655

Actually, I got a unicode error for a show with a unicode character in the title. Had to change line 1745:

print("{0:40s}".format('Working on:') + '[' + fq_filename.encode(termenc) + ']')

#656

Thanks, I’ll make sure that change goes into the next release


#657

I think there’s another spot maybe 20 lines earlier that needs the same fix. I don’t use whatever option causes that code to execute, but when I was doing searches through the code for fq_filename I noticed it.


#658

Thank you, thank you! This script is extremely useful and your work is greatly appreciated! This should be at the top of the list on 3rd Party apps for Tablo. I look forward to any updates that may come, no that I think it needs any.


#659

Oh man… if you only knew what is flying around in my head for 3.0.


#660

how about some hints?

I don’t use SurLaTablo to it’s full potential, but I do use it.


#661

I’ve got a program that apparently was interrupted when recording - two entries for same program, one first 5 minutes, second is last 25 minutes. Is there a method to combine the two?


#662

Nothing directly, but I can certainly look into adding something. You can use the -k (–keepdir) option to preserve the original .ts extractions. Then you could simply concatenate the two and run it through ffmpeg to transcode (not sure if that’s enough info to go on or not). But there might be a “better” way…

Outside of Tablo and surlatablo, you can use ffmpeg to concatenate the end mp4 files: https://trac.ffmpeg.org/wiki/Concatenate


#663

FYI - I was working on limiting the CPU/threads used by SurLaTablo so it doesn’t choke the security camera app running on the same server. Changing the -threads option from 0 to 4 didn’t do anything (this is an 8 core Mac Pro). Then I found a comment on StackOverflow (I think) that said the -threads option needed to be last on the command line (just before the file name). Moving those lines (2277-2279, I think) fixed it. Now ffmpeg is only using half as many threads.


#664

Interesting… did not know about the magic placement. sigh… thanks for the info.

(of course I was thinking about threading the pull down of the data, might clobber the Tablo itself)


#665

If would be nice if I could set that in one place instead of each transcode option. :wink:

Oh, here’s where I read that: https://lorenzo.mile.si/2016/07/limiting-cpu-usage-and-server-load-with-ffmpeg/


#666

:slight_smile: Hey… what do ya want? Everything!