Spaces:
Sleeping
Sleeping
Commit ·
e10dca0
1
Parent(s): 87599df
resize smaller
Browse files- app.py +0 -1
- hls_download.py +3 -3
app.py
CHANGED
|
@@ -58,7 +58,6 @@ def inference(stream_url, start_time, end_time, count_only_api, api_key,
|
|
| 58 |
api_call=False,
|
| 59 |
progress=gr.Progress()):
|
| 60 |
progress(0, desc="Starting...")
|
| 61 |
-
|
| 62 |
x = download_clips(stream_url, os.getcwd(), int(start_time), int(end_time))
|
| 63 |
# check if GPU is available
|
| 64 |
if torch.cuda.is_available():
|
|
|
|
| 58 |
api_call=False,
|
| 59 |
progress=gr.Progress()):
|
| 60 |
progress(0, desc="Starting...")
|
|
|
|
| 61 |
x = download_clips(stream_url, os.getcwd(), int(start_time), int(end_time))
|
| 62 |
# check if GPU is available
|
| 63 |
if torch.cuda.is_available():
|
hls_download.py
CHANGED
|
@@ -15,17 +15,17 @@ def download_clips(stream_url, out_dir, start_time, end_time, resize=True):
|
|
| 15 |
if resize:
|
| 16 |
subprocess.run(['ffmpeg', '-i', stream_url,
|
| 17 |
'-ss', str(start_time - 2),
|
| 18 |
-
'-to', str(end_time +
|
| 19 |
'-r', str(30),
|
| 20 |
'-vcodec', 'libx264',
|
| 21 |
'-crf', str(24),
|
| 22 |
'-preset', 'fast',
|
| 23 |
-
'-vf', 'scale=-2:
|
| 24 |
'-c:a', 'copy', output_file])
|
| 25 |
else:
|
| 26 |
subprocess.run(['ffmpeg', '-i', stream_url,
|
| 27 |
'-ss', str(start_time - 2),
|
| 28 |
-
'-to', str(end_time +
|
| 29 |
'-r', str(30),
|
| 30 |
'-vcodec', 'libx264',
|
| 31 |
'-crf', str(24),
|
|
|
|
| 15 |
if resize:
|
| 16 |
subprocess.run(['ffmpeg', '-i', stream_url,
|
| 17 |
'-ss', str(start_time - 2),
|
| 18 |
+
'-to', str(end_time + 2), # pad end time by a couple of seconds
|
| 19 |
'-r', str(30),
|
| 20 |
'-vcodec', 'libx264',
|
| 21 |
'-crf', str(24),
|
| 22 |
'-preset', 'fast',
|
| 23 |
+
'-vf', 'scale=-2:360',
|
| 24 |
'-c:a', 'copy', output_file])
|
| 25 |
else:
|
| 26 |
subprocess.run(['ffmpeg', '-i', stream_url,
|
| 27 |
'-ss', str(start_time - 2),
|
| 28 |
+
'-to', str(end_time + 2), # pad end time by a couple of seconds
|
| 29 |
'-r', str(30),
|
| 30 |
'-vcodec', 'libx264',
|
| 31 |
'-crf', str(24),
|