Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaker authored Sep 6, 2020
1 parent e8cd5de commit 07b8dda
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
17 changes: 13 additions & 4 deletions ffmpegService.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def mp4x264Encoder(inputsList, outputPathName,filenamePrefix, filtercommand, opt
with fileExistanceLock:
while 1:
fileN+=1
finalOutName = '{}_WmG_{}.webm'.format(filenamePrefix,fileN)
finalOutName = '{}_WmG_{}.mp4'.format(filenamePrefix,fileN)
finalOutName = os.path.join(outputPathName,finalOutName)
outLogFilename = os.path.join('tempVideoFiles','encoder_{}.log'.format(fileN))
if not os.path.exists(finalOutName) and finalOutName not in filesPlannedForCreation:
Expand All @@ -246,6 +246,7 @@ def encoderFunction(br,passNumber,passReason,passPhase=0):

ffmpegcommand=[]
ffmpegcommand+=['ffmpeg' ,'-y']
ffmpegcommand+=["-max_muxing_queue_size", "9999"]
ffmpegcommand+=inputsList

if options.get('audioChannels') == 'No audio' or passPhase==1:
Expand All @@ -265,18 +266,22 @@ def encoderFunction(br,passNumber,passReason,passPhase=0):
,"-start_at_zero"
,"-c:v","libx264"
,"-stats"
,"-max_muxing_queue_size", "9999"
,"-pix_fmt","yuv420p"
,"-bufsize", "3000k"
,"-threads", str(4)
,"-crf" ,'17'
,"-preset", "slow"
,"-preset", "slower"
,"-tune", "film"
,"-movflags","+faststart"]

if sizeLimitMax == 0.0:
ffmpegcommand+=["-b:v","0","-qmin","0","-qmax","10"]
else:
ffmpegcommand+=["-b:v",str(br)]
ffmpegcommand+= ["-b:v", str(br), "-maxrate", str(br)]
"""
"""

if options.get('audioChannels') == 'No audio' or passPhase==1:
ffmpegcommand+=["-an"]
Expand Down Expand Up @@ -328,7 +333,7 @@ def gifEncoder(inputsList, outputPathName,filenamePrefix, filtercommand, options
with fileExistanceLock:
while 1:
fileN+=1
finalOutName = '{}_WmG_{}.webm'.format(filenamePrefix,fileN)
finalOutName = '{}_WmG_{}.gif'.format(filenamePrefix,fileN)
finalOutName = os.path.join(outputPathName,finalOutName)
outLogFilename = os.path.join('tempVideoFiles','encoder_{}.log'.format(fileN))
if not os.path.exists(finalOutName) and finalOutName not in filesPlannedForCreation:
Expand Down Expand Up @@ -524,6 +529,7 @@ def encodeWorker():
while 1:
c = proc.stderr.read(1)
if len(c)==0:
print(ln)
break
if c == b'\r':
print(ln)
Expand All @@ -539,6 +545,7 @@ def encodeWorker():
print(e)
ln=b''
ln+=c
proc.communicate()
totalEncodedSeconds+=etime
statusCallback('Cutting clip {}'.format(i+1),(totalEncodedSeconds)/totalExpectedEncodedSeconds)
self.globalStatusCallback('Cutting clip {}'.format(i+1),(totalEncodedSeconds)/totalExpectedEncodedSeconds)
Expand Down Expand Up @@ -751,6 +758,7 @@ def statsWorker():
while 1:
c=proc.stderr.read(1)
if len(c)==0:
print(ln)
break
if c in b'\r\n':
if b'pts_time' in ln:
Expand All @@ -762,6 +770,7 @@ def statsWorker():
ln=b''
else:
ln+=c
proc.communicate()
except Exception as e:
print(e)

Expand Down
3 changes: 2 additions & 1 deletion webmGeneratorController.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def openProject(self,filename):
def getSaveData(self):
saveData = {}
saveData.update(self.cutselectionController.getStateForSave())
saveData.update(self.videoManager.getStateForSave())
saveData.update(self.videoManager.getStateForSave())
return saveData

def saveProject(self,filename):
if filename is not None:
Expand Down
2 changes: 1 addition & 1 deletion youtubeDLService.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def downloadFunc():

tempPathname='tempDownloadedVideoFiles'
os.path.exists(tempPathname) or os.mkdir(tempPathname)
outfolder = os.path.join(tempPathname,'%(id)s-%(title)s.%(ext)s')
outfolder = os.path.join(tempPathname,'%(title)s-%(id)s.%(ext)s')
proc = sp.Popen(['youtube-dl','--ignore-errors','--restrict-filenames','-f','best',url,'-o',outfolder,'--merge-output-format','mp4'],stdout=sp.PIPE)
l = b''
self.globalStatusCallback('Downloading {}'.format(url),0)
Expand Down

0 comments on commit 07b8dda

Please sign in to comment.