Skip to content

Instantly share code, notes, and snippets.

@rergw
Created January 18, 2020 20:02
Show Gist options
  • Save rergw/ed8dcff4575c8bc1dac1bfa19d3c5a53 to your computer and use it in GitHub Desktop.
Save rergw/ed8dcff4575c8bc1dac1bfa19d3c5a53 to your computer and use it in GitHub Desktop.
python fast_video.py ~/Downloads/2020_01_17_14_43_49.mp4 2
ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/distinct/Downloads/2020_01_17_14_43_49.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2020-01-17 20:02:52
Duration: 00:19:01.85, start: 0.000000, bitrate: 4544 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 720x1280, 4443 kb/s, SAR 1:1 DAR 9:16, 25.82 fps, 90k tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2020-01-17 20:02:52
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 96 kb/s (default)
Metadata:
creation_time : 2020-01-17 20:02:52
handler_name : SoundHandle
Output #0, wav, to 'output.wav':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
ISFT : Lavf56.40.101
Stream #0:0(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s (default)
Metadata:
creation_time : 2020-01-17 20:02:52
handler_name : SoundHandle
encoder : Lavc56.60.100 pcm_s16le
Stream mapping:
Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size= 196636kB time=00:19:01.41 bitrate=1411.3kbits/s
video:0kB audio:196636kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000039%
1000 frames inspected
2000 frames inspected
3000 frames inspected
4000 frames inspected
5000 frames inspected
6000 frames inspected
7000 frames inspected
8000 frames inspected
9000 frames inspected
10000 frames inspected
11000 frames inspected
12000 frames inspected
Traceback (most recent call last):
File "fast_video.py", line 84, in <module>
if getMaxVolume(audioChunk) < 500:
File "fast_video.py", line 34, in getMaxVolume
maxv = np.max(s)
File "<__array_function__ internals>", line 6, in amax
File "/home/distinct/.pyenv/versions/3.7.0/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 2668, in amax
keepdims=keepdims, initial=initial, where=where)
File "/home/distinct/.pyenv/versions/3.7.0/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 90, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment