@@ -124,11 +124,11 @@ def osparam(self):
124124 self .timelimit = C .get (self .site ,'timelimit' ,fallback = None )
125125
126126 self .videochan = C .get (sys .platform ,'videochan' )
127- self .audiochan = C .get (sys .platform ,'audiochan' )
127+ self .audiochan = C .get (sys .platform ,'audiochan' , fallback = None )
128128 self .vcap = C .get (sys .platform ,'vcap' )
129- self .acap = C .get (sys .platform ,'acap' )
129+ self .acap = C .get (sys .platform ,'acap' , fallback = None )
130130 self .hcam = C .get (sys .platform ,'hcam' )
131- self .exe = C .get (sys .platform ,'exe' ,fallback = 'ffmpeg' )
131+ self .exe = getexe ( C .get (sys .platform ,'exe' ,fallback = 'ffmpeg' ) )
132132
133133
134134 self .video_kbps = C .getint (self .site , 'video_kbps' , fallback = None )
@@ -175,15 +175,18 @@ def videostream(self) -> tuple:
175175
176176 def audiostream (self ) -> list :
177177 """
178+ -ac * may not be needed, took out.
178179 -ac 2 NOT -ac 1 to avoid "non monotonous DTS in output stream" errors
179180 """
180- if not self .audio_bps :
181+ if not self .audio_bps or not self . acap or not self . audiochan :
181182 return []
182183
183184 if not self .vidsource == 'file' :
184- return ['-f' , self .acap , '-ac' ,'2' , '-i' , self .audiochan ]
185- else : # file input
186- return ['-ac' ,'2' ]
185+ return ['-f' , self .acap , '-i' , self .audiochan ]
186+ else : # file input
187+ return []
188+ # else: # file input
189+ # return ['-ac','2']
187190
188191
189192 def audiocomp (self ) -> list :
@@ -193,7 +196,7 @@ def audiocomp(self) -> list:
193196 https://www.facebook.com/facebookmedia/get-started/live
194197 """
195198
196- if not self .audio_bps :
199+ if not self .audio_bps or not self . acap or not self . audiochan :
197200 return []
198201
199202 return ['-c:a' ,'aac' ,
@@ -231,7 +234,8 @@ def screengrab(self) -> list:
231234 if sys .platform == 'linux' :
232235 vid1 += ['-i' , ':0.0+{},{}' .format (self .origin [0 ], self .origin [1 ])]
233236 elif sys .platform == 'win32' :
234- vid1 += ['-i' , self .videochan ]
237+ vid1 += ['-offset_x' ,self .origin [0 ],'-offset_y' ,self .origin [1 ],
238+ '-i' , self .videochan ,]
235239 elif sys .platform == 'darwin' :
236240 pass # FIXME: verify
237241
@@ -433,9 +437,9 @@ def __init__(self, ini:Path, outfn:Path=None, clobber:bool=False):
433437 aud1 = self .audiostream ()
434438 aud2 = self .audiocomp ()
435439
436- cmd = [self .exe ] + vid1 + vid2 + aud1 + aud2
440+ cmd = [self .exe ] + vid1 + aud1 + vid2 + aud2
437441
438- if not outfn .suffix : # ffmpeg relies on suffix for container type, this is a fallback.
442+ if outfn and not outfn .suffix : # ffmpeg relies on suffix for container type, this is a fallback.
439443 cmd += ['-f' ,'flv' ]
440444
441445 cmd += [str (outfn )]
@@ -446,13 +450,16 @@ def __init__(self, ini:Path, outfn:Path=None, clobber:bool=False):
446450 if clobber :
447451 cmd += ['-y' ]
448452
449- if sys .platform == 'win32' :
450- cmd += ['-copy_ts' ]
453+ # if sys.platform == 'win32':
454+ # cmd += ['-copy_ts']
451455
452456 print ('\n ' ,' ' .join (cmd ),'\n ' )
453457
454458 if outfn :
455- ret = sp .run (cmd ).returncode
456- print ('FFmpeg returncode' ,ret )
459+ try :
460+ ret = sp .run (cmd ).returncode
461+ print ('FFmpeg returncode' ,ret )
462+ except FileNotFoundError :
463+ pass
457464 else :
458465 print ('specify filename to save screen capture with audio to disk.' )
0 commit comments