pyTivo Discussion Forum Forum Index pyTivo Discussion Forum
Answers and the development of pyTivo a TiVo transcoding server
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Remux without reencoding for MKV, AVCHD, etc. in Push
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> pyTivo
 View previous topic :: View next topic  
Author Message
lucasnz



Joined: 13 Sep 2010
Posts: 251

PostPosted: Sat Aug 06, 2011 9:02 am    Post subject: Reply with quote

Iluvatar wrote:
With temp_share set, pushing a file that fails requirements for remux and requires transcode will not work as expected. pyTivo crashes with file not found because it now thinks the original file is located at temp_share+basepath


Ok pushed another update. That should fix this issue.
Back to top
View user's profile Send private message
Iluvatar



Joined: 29 Feb 2008
Posts: 335

PostPosted: Sat Aug 06, 2011 5:51 pm    Post subject: Reply with quote

lucasnz wrote:
Iluvatar wrote:
With temp_share set, pushing a file that fails requirements for remux and requires transcode will not work as expected. pyTivo crashes with file not found because it now thinks the original file is located at temp_share+basepath


Ok pushed another update. That should fix this issue.


That fixed the issue. Thanks. It works with everything I can throw at it.

With wmcbrine's remux code and all your updates you have worked on lately it really has taken pyTivo usability to a whole new level. Thanks guys!
Back to top
View user's profile Send private message
alton987



Joined: 30 Aug 2011
Posts: 3

PostPosted: Tue Aug 30, 2011 2:39 am    Post subject: Re: Remux without reencoding for MKV, AVCHD, etc. in Push Reply with quote

Sorry for being a complete newb but how do I add this to the "pyTivo for jython/windows installer" I got it running but would prefer 720p mkv's to just be remuxxed not encoded.

Thanks
ALton
Back to top
View user's profile Send private message
jcthorne



Joined: 30 Jan 2008
Posts: 243
Location: Houston, TX

PostPosted: Tue Aug 30, 2011 11:52 am    Post subject: Reply with quote

Any chance of this work being rolled into wmcbrine's mainline version? Now that the idea works, seems a good addition to the base.
Back to top
View user's profile Send private message
Iluvatar



Joined: 29 Feb 2008
Posts: 335

PostPosted: Tue Aug 30, 2011 1:59 pm    Post subject: Re: Remux without reencoding for MKV, AVCHD, etc. in Push Reply with quote

alton987 wrote:
Sorry for being a complete newb but how do I add this to the "pyTivo for jython/windows installer" I got it running but would prefer 720p mkv's to just be remuxxed not encoded.

Thanks
ALton


Depending upon if the main pyTivo files are modified or not (I don't know about which project you are speaking of) you could just be fine by downloading the latest snapshot and overwriting the files.

If the pyTivo files are modified by your program then getting these changes are much harder and would require merging the code.

The lucasnz fork is located here.


Last edited by Iluvatar on Tue Aug 30, 2011 2:03 pm; edited 4 times in total
Back to top
View user's profile Send private message
Iluvatar



Joined: 29 Feb 2008
Posts: 335

PostPosted: Tue Aug 30, 2011 2:01 pm    Post subject: Reply with quote

jcthorne wrote:
Any chance of this work being rolled into wmcbrine's mainline version? Now that the idea works, seems a good addition to the base.


I haven't heard any reason why it couldn't be before but I agree that these changes would be helpful for most. Many of the people getting started with pyTivo just download wmcbrine because they don't know about the other forks.
Back to top
View user's profile Send private message
brennok



Joined: 08 May 2010
Posts: 11

PostPosted: Wed Aug 31, 2011 1:22 am    Post subject: Reply with quote

I definitely agree here. I didn't know about this fork until I read it mentioned over in a MKV thread on TiVo community.
Back to top
View user's profile Send private message
alton987



Joined: 30 Aug 2011
Posts: 3

PostPosted: Wed Aug 31, 2011 4:52 am    Post subject: Stupid ? Reply with quote

How can I tell after the file was pushed to the Tivo if it was remuxed or re-encoded?
Back to top
View user's profile Send private message
Iluvatar



Joined: 29 Feb 2008
Posts: 335

PostPosted: Wed Aug 31, 2011 9:02 am    Post subject: Re: Stupid ? Reply with quote

alton987 wrote:
How can I tell after the file was pushed to the Tivo if it was remuxed or re-encoded?


The easiest way is to review the file size on the TiVo. If it is near the original (give or take a bit just in case the audio needed to be transcoded) then it was probably remuxed. If it is several times the size of the original then it was probably transcoded.

To be 100% certain you need to review your logs. Right before FFmpeg really gets going you should see a line like this:

Code:

DEBUG:pyTivo.video.transcode:remuxing /Volumes/Media/TiVo/Last Chance to See/Northern White Rhino.mkv to /Volumes/Media/TiVo/Northern White Rhino.mp4.pyTivo-temp


Above this will also be logged clues as to why your file failed the remux checklist if it had to be transcoded.
Back to top
View user's profile Send private message
KevinG



Joined: 29 Sep 2009
Posts: 17

PostPosted: Sun Sep 04, 2011 1:07 pm    Post subject: Reply with quote

This new "feature" seems to break me.

Please see my thread over in the support area:

http://pytivo.sourceforge.net/forum/mkv-files-transfering-but-video-isn-t-smooth-t1822.html#12059

It seems that "remuxed" files don't play smoothly, but allowing them to re-encode makes them play perfectly.

Anyone else notice this?

I'm on this build now: "2011-08-06 lucas_nz only mp4s that are remuxed will be in the temp share."
But the same thing happened on wmcbrine's branch.
Back to top
View user's profile Send private message
lucasnz



Joined: 13 Sep 2010
Posts: 251

PostPosted: Mon Sep 05, 2011 6:07 am    Post subject: Reply with quote

Could be the version of ffmpeg you are using or something wrong with the source file.. Suggest you either try more files or a different version of ffmpeg. I use the radian build that is mentioned in one of the pinned forums.
Back to top
View user's profile Send private message
KevinG



Joined: 29 Sep 2009
Posts: 17

PostPosted: Mon Sep 05, 2011 1:32 pm    Post subject: Reply with quote

lucasnz wrote:
Could be the version of ffmpeg you are using or something wrong with the source file.. Suggest you either try more files or a different version of ffmpeg. I use the radian build that is mentioned in one of the pinned forums.


Apparently, the S3 isn't quite as good as the premiere in the case...and it stumbles on some video. See the other thread that I pointed to.
Back to top
View user's profile Send private message
alton987



Joined: 30 Aug 2011
Posts: 3

PostPosted: Mon Sep 05, 2011 7:08 pm    Post subject: Log? Reply with quote

Where is the log I can not find it?
Back to top
View user's profile Send private message
Iluvatar



Joined: 29 Feb 2008
Posts: 335

PostPosted: Thu Jan 12, 2012 5:12 pm    Post subject: Reply with quote

I have adjusted the remux function to add a random string on the temp file name as to avoid file name collisions if file already exists. I ran into this by killing pyTivo in middle of remux or from crashes while playing with the code.

Hopefully this prevents 'if os.path.exists(outFile):' from ever being true and requiring a full transcode.

The patch also adds a get_random() function in config.py that can be called for a string of 3 digits (can be changed easily enough for something different).

Code:

From 2ff5b21f80c78068325bee185cb0b04b8283894a Mon Sep 17 00:00:00 2001
From: Taylor Spencer <taylorspencer@hotmail.com>
Date: Thu, 12 Jan 2012 11:05:00 -0500
Subject: [PATCH] adds a random string onto the temporary output file for mp4
 remuxing.  This should prevent a full transcode due to
 leftover pyTivo-temp files with the same name (from
 pyTivo/FFmpeg crashes most likely).

Also adds a get_random() function in config.py that can be called for a random 3 digit string.
---
 config.py                  |    3 +++
 plugins/video/transcode.py |   13 +++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/config.py b/config.py
index 53abef9..fb9b017 100644
--- a/config.py
+++ b/config.py
@@ -405,6 +405,9 @@ def get_tsn(name, tsn=None, raw=False):
         pass
     return None
 
+def get_random():
+    return ''.join([random.choice(string.digits) for i in range(3)])
+
 # Parse a bitrate using the SI/IEEE suffix values as if by ffmpeg
 # For example, 2K==2000, 2Ki==2048, 2MB==16000000, 2MiB==16777216
 # Algorithm: http://svn.mplayerhq.hu/ffmpeg/trunk/libavcodec/eval.c
diff --git a/plugins/video/transcode.py b/plugins/video/transcode.py
index 50186fa..d94c5ed 100644
--- a/plugins/video/transcode.py
+++ b/plugins/video/transcode.py
@@ -693,16 +693,17 @@ def mp4_remuxable(inFile, tsn=''):
     return tivo_compatible_video(vInfo, tsn, 'video/mp4')[0]
 
 def mp4_remux(inFile, basename, tsn='', temp_share_path=''):
-    outFile = inFile + '.pyTivo-temp'
-    newname = basename + '.pyTivo-temp'
-
+    unique_id = '_' + config.get_random()
+    outFile = inFile  + unique_id + '.pyTivo-temp'
+    newname = basename  + unique_id + '.pyTivo-temp'
+   
     if temp_share_path:
-        newname = os.path.splitext(os.path.split(basename)[1])[0] + '.mp4.pyTivo-temp'
+        newname = os.path.splitext(os.path.split(basename)[1])[0]  + unique_id + '.mp4.pyTivo-temp'
         outFile = os.path.join(temp_share_path, newname)
-
+       
     if os.path.exists(outFile):
         debug('File already exists.  Performing full transcode instead')
-        return None  # ugh!
+        return None
 
     ffmpeg_path = config.get_bin('ffmpeg')
     fname = unicode(inFile, 'utf-8')
--
1.7.5.4




addRandomtoFileName.diff.txt
 Description:

Download
 Filename:  addRandomtoFileName.diff.txt
 Filesize:  2.18 KB
 Downloaded:  7 Time(s)


_________________
My pyTivo fork - Read link for changes
FFmpeg for OS X
Back to top
View user's profile Send private message
wmcbrine



Joined: 04 Jan 2008
Posts: 2009
Location: Maryland

PostPosted: Thu Jan 12, 2012 5:45 pm    Post subject: Reply with quote

My preferred solution for this would be more like: Have a reference counter for the temporary file; if the file exists at remux time, increment it; after a transfer, decrement the counter; if the counter is zero, remove the file. I didn't do it, because a) I was lazy, and b) how often would two TiVos request the same file at the same time, anyway?

But neither of these methods really accounts for crashes. Yours potentially leaves an ever-increasing number of partially-remuxed files, while mine could still leave one.

_________________
My pyTivo fork . My page
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> pyTivo All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 6 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Site is in NO WAY affiliated with TiVo Inc

Powered by phpBB © 2001, 2005 phpBB Group
phpBB SEO

Get pytivo at SourceForge.net. Fast, secure and Free Open Source software downloads
[ Time: 0.1900s ][ Queries: 19 (0.0213s) ][ GZIP on - Debug on ]