wmcbrine / pytivo

pyTivo is both an HMO and GoBack server. Similar to TiVo Desktop pyTivo loads many standard video compression codecs and outputs mpeg2 video to the TiVo. However, pyTivo is able to load MANY more file types than TiVo Desktop.
http://pytivo.org/
127 stars 42 forks source link

Fix size estimation for MPEG-4 transport streams. #34

Open mhkrebs opened 4 years ago

mhkrebs commented 4 years ago

This can reduce the number of programs that TiVo deletes upon their transfer.

TiVo requests the expected transfer size before it tries to actually transfer a file, and it does not send a desired MIME type along with that request. When that MIME type is missing and the vCodec is "h264", tivo_compatible_video() returned false -- which resulted in __est_size() estimating the size as if it will transcode the video. And, without also having this fix in tivo_compatible_container(), that estimated size can be 2-3 times too big because the bitrate may not reflect what's in the actual file.

wmcbrine commented 4 years ago

It would probably make sense to condition this assumption of compatibility on the model of the requesting TiVo.

mhkrebs commented 4 years ago

Ah, that makes sense. I was about to suggest that you could fix it in a better way if you want. I was aiming for something simple, and I'm not a huge python user.

BTW, the context for this is in https://www.tivocommunity.com/community/index.php?threads/working-details-of-going-away-soon-space-needed-deletes.560372/

mhkrebs commented 4 years ago

Cool, I found that is_ts_capable() function and added a call to that.

Feel free to scrap this all and do something else, of course. :)