x1001000 commited on
Commit
2c59990
·
1 Parent(s): e17b5d0

return probe

Browse files
Files changed (1) hide show
  1. app.py +26 -25
app.py CHANGED
@@ -10,31 +10,32 @@ def get_media_info(file_path):
10
  """
11
  try:
12
  probe = ffmpeg.probe(file_path)
13
- video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
14
- audio_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'audio'), None)
15
-
16
- if video_stream:
17
- width = int(video_stream['width'])
18
- height = int(video_stream['height'])
19
- frame_rate = video_stream['avg_frame_rate']
20
- frame_count = int(video_stream['nb_frames'])
21
- else:
22
- width, height, frame_rate, frame_count = None, None, None, None
23
-
24
- if audio_stream:
25
- sample_rate = int(audio_stream['sample_rate'])
26
- channels = int(audio_stream['channels'])
27
- else:
28
- sample_rate, channels = None, None
29
-
30
- return {
31
- 'width': width,
32
- 'height': height,
33
- 'frame_rate': frame_rate,
34
- 'frame_count': frame_count,
35
- 'sample_rate': sample_rate,
36
- 'channels': channels,
37
- }
 
38
 
39
  except Exception as e:
40
  return {'error': str(e)}
 
10
  """
11
  try:
12
  probe = ffmpeg.probe(file_path)
13
+ return probe
14
+ # video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
15
+ # audio_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'audio'), None)
16
+
17
+ # if video_stream:
18
+ # width = int(video_stream['width'])
19
+ # height = int(video_stream['height'])
20
+ # frame_rate = video_stream['avg_frame_rate']
21
+ # frame_count = int(video_stream['nb_frames'])
22
+ # else:
23
+ # width, height, frame_rate, frame_count = None, None, None, None
24
+
25
+ # if audio_stream:
26
+ # sample_rate = int(audio_stream['sample_rate'])
27
+ # channels = int(audio_stream['channels'])
28
+ # else:
29
+ # sample_rate, channels = None, None
30
+
31
+ # return {
32
+ # 'width': width,
33
+ # 'height': height,
34
+ # 'frame_rate': frame_rate,
35
+ # 'frame_count': frame_count,
36
+ # 'sample_rate': sample_rate,
37
+ # 'channels': channels,
38
+ # }
39
 
40
  except Exception as e:
41
  return {'error': str(e)}