In [22]:
#@title Check GPU
#@markdown Run this to connect to a Colab Instance, and see what GPU Google gave you.

gpu = !nvidia-smi --query-gpu=gpu_name --format=csv
print(gpu[1])
print("The Tesla T4 and P100 are fast and support hardware encoding. The K80 and P4 are slower.")
print("Sometimes resetting the instance in the 'runtime' tab will give you a different GPU.")


The Tesla T4 and P100 are fast and support hardware encoding. The K80 and P4 are slower.
Sometimes resetting the instance in the 'runtime' tab will give you a different GPU.

In [23]:
from google.colab import drive
drive.mount('/content/drive')


Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).

In [24]:
!pip install scenedetect


Requirement already satisfied: scenedetect in /usr/local/lib/python3.6/dist-packages (0.5.1.1)
Requirement already satisfied: Click in /usr/local/lib/python3.6/dist-packages (from scenedetect) (7.1.1)
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from scenedetect) (1.18.1)

In [0]:
from __future__ import print_function
import os

import scenedetect
from scenedetect.video_manager import VideoManager
from scenedetect.scene_manager import SceneManager
from scenedetect.frame_timecode import FrameTimecode
from scenedetect.stats_manager import StatsManager
from scenedetect.detectors import ContentDetector

In [0]:
def detect():

    # Create a video_manager point to video file testvideo.mp4. Note that multiple
    # videos can be appended by simply specifying more file paths in the list
    # passed to the VideoManager constructor. Note that appending multiple videos
    # requires that they all have the same frame size, and optionally, framerate.
    video_manager = VideoManager(['vid/'+folder+'/'+vid])
    stats_manager = StatsManager()
    scene_manager = SceneManager(stats_manager)
    # Add ContentDetector algorithm (constructor takes detector options like threshold).
    scene_manager.add_detector(ContentDetector())
    base_timecode = video_manager.get_base_timecode()

    try:
        # If stats file exists, load it.
        if os.path.exists(STATS_FILE_PATH):
            # Read stats from CSV file opened in read mode:
            with open(STATS_FILE_PATH, 'r') as stats_file:
                stats_manager.load_from_csv(stats_file, base_timecode)

        start_time = base_timecode + 20     # 00:00:00.667
        end_time = base_timecode + 20.0     # 00:00:20.000
        # Set video_manager duration to read frames from 00:00:00 to 00:00:20.
        video_manager.set_duration(start_time=start_time, end_time=end_time)

        # Set downscale factor to improve processing speed (no args means default).
        video_manager.set_downscale_factor()

        # Start video_manager.
        video_manager.start()

        # Perform scene detection on video_manager.
        scene_manager.detect_scenes(frame_source=video_manager)

        # Obtain list of detected scenes.
        scene_list = scene_manager.get_scene_list(base_timecode)
        # Like FrameTimecodes, each scene in the scene_list can be sorted if the
        # list of scenes becomes unsorted.

        print('List of scenes obtained:')
        for i, scene in enumerate(scene_list):
            print('    Scene %2d: Start %s / Frame %d, End %s / Frame %d' % (
                i+1,
                scene[0].get_timecode(), scene[0].get_frames(),
                scene[1].get_timecode(), scene[1].get_frames(),))

        # We only write to the stats file if a save is required:
        if stats_manager.is_save_required():
            with open(STATS_FILE_PATH, 'w') as stats_file:
                stats_manager.save_to_csv(stats_file, base_timecode)

    finally:
        video_manager.release()

In [0]:
from os import listdir
from os.path import isfile, join

In [28]:
for folder in ['2','3']:
  %cd {'"//content/drive/My Drive/kontext/deold/'+folder+'"'}
  !mkdir scenes
  !mkdir goodscenes
  mypath='./'
  onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
  for vid in onlyfiles:
    #filter only for certain videos if you want
    for filt in ['szf2']:
      if filt in vid:
        STATS_FILE_PATH = '/scenes/testvideo.stats-'+vid+'.csv'
        !scenedetect -i {vid} -o ./scenes detect-content -t 27 list-scenes save-images split-video


/content/drive/My Drive/kontext/deold/2
mkdir: cannot create directory ‘scenes’: File exists
mkdir: cannot create directory ‘goodscenes’: File exists
[PySceneDetect] Output directory set:
  /content/drive/My Drive/kontext/deold/2/scenes
[PySceneDetect] Loaded 1 video, framerate: 25.01 FPS, resolution: 1600 x 972
[PySceneDetect] Downscale factor set to 5, effective resolution: 320 x 194
[PySceneDetect] Scene list CSV file name format:
  $VIDEO_NAME-Scenes.csv
[PySceneDetect] Image output format set: JPEG
[PySceneDetect] FFmpeg codec args set: -c:v libx264 -preset veryfast -crf 22 -c:a copy
[PySceneDetect] Video output file name format: $VIDEO_NAME-Scene-$SCENE_NUMBER
[PySceneDetect] Detecting scenes...
100% 2328/2328 [00:18<00:00, 124.17frames/s]
[PySceneDetect] Processed 2328 frames in 18.7 seconds (average 124.16 FPS).
[PySceneDetect] Detected 7 scenes, average shot length 13.3 seconds.
[PySceneDetect] Writing scene list to CSV file:
  /content/drive/My Drive/kontext/deold/2/scenes/szf2_2.00x_1600x972-Scenes.csv
[PySceneDetect] Scene List:
-----------------------------------------------------------------------
 | Scene # | Start Frame |  Start Time  |  End Frame  |   End Time   |
-----------------------------------------------------------------------
 |      1  |           0 | 00:00:00.000 |        1240 | 00:00:49.580 |
 |      2  |        1240 | 00:00:49.580 |        1343 | 00:00:53.699 |
 |      3  |        1343 | 00:00:53.699 |        1430 | 00:00:57.177 |
 |      4  |        1430 | 00:00:57.177 |        1634 | 00:01:05.334 |
 |      5  |        1634 | 00:01:05.334 |        1698 | 00:01:07.893 |
 |      6  |        1698 | 00:01:07.893 |        1805 | 00:01:12.171 |
 |      7  |        1805 | 00:01:12.171 |        2328 | 00:01:33.083 |
-----------------------------------------------------------------------

[PySceneDetect] Comma-separated timecode list:
  00:00:49.580,00:00:53.699,00:00:57.177,00:01:05.334,00:01:07.893,00:01:12.171
[PySceneDetect] Downscale factor set to 1, effective resolution: 1600 x 972
[PySceneDetect] Generating output images (3 per scene)...
100% 21/21 [00:09<00:00,  1.72images/s]
[PySceneDetect] Splitting input video using ffmpeg, output path template:
  /content/drive/My Drive/kontext/deold/2/scenes/$VIDEO_NAME-Scene-$SCENE_NUMBER.mp4
  0% 0/2328 [00:00<?, ?frame/s]ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --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-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/content/drive/My Drive/kontext/deold/2/szf2_2.00x_1600x972.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.29.100
  Duration: 00:01:33.08, start: 0.000000, bitrate: 4374 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 1600x972 [SAR 1:1 DAR 400:243], 4373 kb/s, 25.01 fps, 25.01 tbr, 10004 tbn, 2501 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x5569b5079900] using SAR=1/1
[libx264 @ 0x5569b5079900] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x5569b5079900] profile High, level 4.0
[libx264 @ 0x5569b5079900] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/content/drive/My Drive/kontext/deold/2/scenes/szf2_2.00x_1600x972-Scene-001.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf57.83.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1600x972 [SAR 1:1 DAR 400:243], q=-1--1, 25.01 fps, 10004 tbn, 25.01 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 1240 fps= 27 q=-1.0 Lsize=   15075kB time=00:00:49.46 bitrate=2496.9kbits/s speed=1.08x    
video:15066kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.064140%
[libx264 @ 0x5569b5079900] frame I:14    Avg QP:14.98  size: 40498
[libx264 @ 0x5569b5079900] frame P:965   Avg QP:19.72  size: 13792
[libx264 @ 0x5569b5079900] frame B:261   Avg QP:21.51  size:  5939
[libx264 @ 0x5569b5079900] consecutive B-frames: 66.9% 11.5% 11.4% 10.3%
[libx264 @ 0x5569b5079900] mb I  I16..4: 37.2% 47.9% 14.9%
[libx264 @ 0x5569b5079900] mb P  I16..4:  6.9%  8.2%  0.1%  P16..4: 24.8%  9.5%  4.3%  0.0%  0.0%    skip:46.1%
[libx264 @ 0x5569b5079900] mb B  I16..4:  1.8%  2.7%  0.0%  B16..8: 15.9%  4.0%  0.3%  direct: 5.0%  skip:70.3%  L0:49.5% L1:40.2% BI:10.3%
[libx264 @ 0x5569b5079900] 8x8 transform intra:53.9% inter:59.7%
[libx264 @ 0x5569b5079900] coded y,uvDC,uvAC intra: 33.3% 18.4% 0.4% inter: 9.5% 2.8% 0.0%
[libx264 @ 0x5569b5079900] i16 v,h,dc,p: 59% 27% 11%  2%
[libx264 @ 0x5569b5079900] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 27% 40%  1%  1%  1%  1%  1%  2%
[libx264 @ 0x5569b5079900] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 21% 12%  5%  6%  7%  6%  7%  6%
[libx264 @ 0x5569b5079900] i8c dc,h,v,p: 65% 17% 17%  1%
[libx264 @ 0x5569b5079900] Weighted P-Frames: Y:3.9% UV:0.2%
[libx264 @ 0x5569b5079900] kb/s:2489.13
[PySceneDetect] Output from ffmpeg for Scene 1 shown above, splitting remaining scenes...
100% 2328/2328 [01:24<00:00, 27.11frame/s]
[PySceneDetect] Average processing speed 27.56 frames/sec.
[PySceneDetect] Video splitting completed, individual scenes written to disk.
Exception ignored in: <bound method tqdm.__del__ of 100% 2328/2328 [01:24<00:00, 27.11frame/s]>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 931, in __del__
    self.close()
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 1133, in close
    self._decr_instances(self)
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 496, in _decr_instances
    cls.monitor.exit()
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_monitor.py", line 52, in exit
    self.join()
  File "/usr/lib/python3.6/threading.py", line 1053, in join
    raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread
/content/drive/My Drive/kontext/deold/3
mkdir: cannot create directory ‘scenes’: File exists
mkdir: cannot create directory ‘goodscenes’: File exists
[PySceneDetect] Output directory set:
  /content/drive/My Drive/kontext/deold/3/scenes
[PySceneDetect] Loaded 1 video, framerate: 25.00 FPS, resolution: 1186 x 720
[PySceneDetect] Downscale factor set to 4, effective resolution: 296 x 180
[PySceneDetect] Scene list CSV file name format:
  $VIDEO_NAME-Scenes.csv
[PySceneDetect] Image output format set: JPEG
[PySceneDetect] FFmpeg codec args set: -c:v libx264 -preset veryfast -crf 22 -c:a copy
[PySceneDetect] Video output file name format: $VIDEO_NAME-Scene-$SCENE_NUMBER
[PySceneDetect] Detecting scenes...
100% 2327/2327 [00:19<00:00, 118.55frames/s]
[PySceneDetect] Processed 2327 frames in 19.6 seconds (average 118.54 FPS).
[PySceneDetect] Detected 23 scenes, average shot length 4.0 seconds.
[PySceneDetect] Writing scene list to CSV file:
  /content/drive/My Drive/kontext/deold/3/scenes/szf2_2.00x_1600x972_21-Scenes.csv
[PySceneDetect] Scene List:
-----------------------------------------------------------------------
 | Scene # | Start Frame |  Start Time  |  End Frame  |   End Time   |
-----------------------------------------------------------------------
 |      1  |           0 | 00:00:00.000 |         144 | 00:00:05.760 |
 |      2  |         144 | 00:00:05.760 |         372 | 00:00:14.880 |
 |      3  |         372 | 00:00:14.880 |         399 | 00:00:15.960 |
 |      4  |         399 | 00:00:15.960 |         492 | 00:00:19.680 |
 |      5  |         492 | 00:00:19.680 |         528 | 00:00:21.120 |
 |      6  |         528 | 00:00:21.120 |         621 | 00:00:24.840 |
 |      7  |         621 | 00:00:24.840 |         643 | 00:00:25.720 |
 |      8  |         643 | 00:00:25.720 |         712 | 00:00:28.480 |
 |      9  |         712 | 00:00:28.480 |         761 | 00:00:30.440 |
 |     10  |         761 | 00:00:30.440 |         842 | 00:00:33.680 |
 |     11  |         842 | 00:00:33.680 |         896 | 00:00:35.840 |
 |     12  |         896 | 00:00:35.840 |         978 | 00:00:39.120 |
 |     13  |         978 | 00:00:39.120 |        1134 | 00:00:45.360 |
 |     14  |        1134 | 00:00:45.360 |        1240 | 00:00:49.600 |
 |     15  |        1240 | 00:00:49.600 |        1342 | 00:00:53.680 |
 |     16  |        1342 | 00:00:53.680 |        1429 | 00:00:57.160 |
 |     17  |        1429 | 00:00:57.160 |        1514 | 00:01:00.560 |
 |     18  |        1514 | 00:01:00.560 |        1566 | 00:01:02.640 |
 |     19  |        1566 | 00:01:02.640 |        1633 | 00:01:05.320 |
 |     20  |        1633 | 00:01:05.320 |        1697 | 00:01:07.880 |
 |     21  |        1697 | 00:01:07.880 |        1748 | 00:01:09.920 |
 |     22  |        1748 | 00:01:09.920 |        1802 | 00:01:12.080 |
 |     23  |        1802 | 00:01:12.080 |        2327 | 00:01:33.080 |
-----------------------------------------------------------------------

[PySceneDetect] Comma-separated timecode list:
  00:00:05.760,00:00:14.880,00:00:15.960,00:00:19.680,00:00:21.120,00:00:24.840,00:00:25.720,00:00:28.480,00:00:30.440,00:00:33.680,00:00:35.840,00:00:39.120,00:00:45.360,00:00:49.600,00:00:53.680,00:00:57.160,00:01:00.560,00:01:02.640,00:01:05.320,00:01:07.880,00:01:09.920,00:01:12.080
[PySceneDetect] Downscale factor set to 1, effective resolution: 1186 x 720
[PySceneDetect] Generating output images (3 per scene)...
100% 69/69 [00:13<00:00,  1.71images/s][PySceneDetect] Splitting input video using ffmpeg, output path template:
  /content/drive/My Drive/kontext/deold/3/scenes/$VIDEO_NAME-Scene-$SCENE_NUMBER.mp4

  0% 0/2327 [00:00<?, ?frame/s]ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --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-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/content/drive/My Drive/kontext/deold/3/szf2_2.00x_1600x972_21.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:01:33.08, start: 0.000000, bitrate: 4213 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1186x720 [SAR 1:1 DAR 593:360], 4204 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 2 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x5627270c8800] using SAR=1/1
[libx264 @ 0x5627270c8800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x5627270c8800] profile High, level 3.1
[libx264 @ 0x5627270c8800] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/content/drive/My Drive/kontext/deold/3/scenes/szf2_2.00x_1600x972_21-Scene-001.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuvj420p(pc), 1186x720 [SAR 1:1 DAR 593:360], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 2 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
frame=  144 fps= 34 q=-1.0 Lsize=    1331kB time=00:00:05.75 bitrate=1894.1kbits/s speed=1.38x    
video:1324kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.457550%
[libx264 @ 0x5627270c8800] frame I:1     Avg QP:18.81  size: 44620
[libx264 @ 0x5627270c8800] frame P:38    Avg QP:20.50  size: 22086
[libx264 @ 0x5627270c8800] frame B:105   Avg QP:24.22  size:  4487
[libx264 @ 0x5627270c8800] consecutive B-frames:  0.7%  5.6%  2.1% 91.7%
[libx264 @ 0x5627270c8800] mb I  I16..4: 30.0% 39.4% 30.5%
[libx264 @ 0x5627270c8800] mb P  I16..4: 18.7% 13.9%  0.9%  P16..4: 22.1% 17.0% 12.9%  0.0%  0.0%    skip:14.4%
[libx264 @ 0x5627270c8800] mb B  I16..4:  1.9%  1.8%  0.0%  B16..8: 18.5%  5.5%  0.5%  direct:17.5%  skip:54.3%  L0:56.2% L1:31.5% BI:12.3%
[libx264 @ 0x5627270c8800] 8x8 transform intra:42.9% inter:65.3%
[libx264 @ 0x5627270c8800] coded y,uvDC,uvAC intra: 26.5% 45.6% 9.1% inter: 11.8% 38.6% 0.7%
[libx264 @ 0x5627270c8800] i16 v,h,dc,p: 77% 14%  8%  1%
[libx264 @ 0x5627270c8800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 25% 30%  2%  1%  2%  1%  2%  2%
[libx264 @ 0x5627270c8800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 15% 11%  6%  7%  9%  5% 10%  5%
[libx264 @ 0x5627270c8800] i8c dc,h,v,p: 59% 16% 21%  4%
[libx264 @ 0x5627270c8800] Weighted P-Frames: Y:81.6% UV:78.9%
[libx264 @ 0x5627270c8800] kb/s:1881.98
[PySceneDetect] Output from ffmpeg for Scene 1 shown above, splitting remaining scenes...

  6% 144/2327 [00:04<01:04, 33.64frame/s]
 16% 372/2327 [00:11<00:58, 33.64frame/s]
 17% 399/2327 [00:12<01:13, 26.14frame/s]
 21% 492/2327 [00:15<01:04, 28.48frame/s]
 23% 528/2327 [00:16<01:04, 27.70frame/s]
 27% 621/2327 [00:19<01:01, 27.61frame/s]
 28% 643/2327 [00:21<01:16, 21.96frame/s]
 31% 712/2327 [00:24<01:09, 23.12frame/s]
 33% 761/2327 [00:25<01:04, 24.14frame/s]
 36% 842/2327 [00:28<00:58, 25.28frame/s]
 39% 896/2327 [00:30<00:55, 26.01frame/s]
 42% 978/2327 [00:33<00:50, 26.88frame/s]
 49% 1134/2327 [00:38<00:42, 27.79frame/s]
 53% 1240/2327 [00:42<00:39, 27.21frame/s]
 58% 1342/2327 [00:46<00:35, 27.49frame/s]
 61% 1429/2327 [00:49<00:32, 27.50frame/s]
 65% 1514/2327 [00:52<00:29, 27.99frame/s]
 67% 1566/2327 [00:54<00:28, 27.06frame/s]
 70% 1633/2327 [00:56<00:25, 27.13frame/s]
 73% 1697/2327 [00:59<00:23, 27.12frame/s]
 75% 1748/2327 [01:01<00:21, 26.46frame/s]
 77% 1802/2327 [01:03<00:20, 25.62frame/s]
100% 2327/2327 [01:15<00:00, 29.28frame/s]
[PySceneDetect] Average processing speed 30.78 frames/sec.
[PySceneDetect] Video splitting completed, individual scenes written to disk.

Exception ignored in: <bound method tqdm.__del__ of 100% 2327/2327 [01:15<00:00, 29.28frame/s]>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 931, in __del__
    self.close()
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 1133, in close
    self._decr_instances(self)
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 496, in _decr_instances
    cls.monitor.exit()
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_monitor.py", line 52, in exit
    self.join()
  File "/usr/lib/python3.6/threading.py", line 1053, in join
    raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread
[PySceneDetect] Output directory set:
  /content/drive/My Drive/kontext/deold/3/scenes
[PySceneDetect] Loaded 1 video, framerate: 25.00 FPS, resolution: 1186 x 720
[PySceneDetect] Downscale factor set to 4, effective resolution: 296 x 180
[PySceneDetect] Scene list CSV file name format:
  $VIDEO_NAME-Scenes.csv
[PySceneDetect] Image output format set: JPEG
[PySceneDetect] FFmpeg codec args set: -c:v libx264 -preset veryfast -crf 22 -c:a copy
[PySceneDetect] Video output file name format: $VIDEO_NAME-Scene-$SCENE_NUMBER
[PySceneDetect] Detecting scenes...
100% 2327/2327 [00:19<00:00, 119.19frames/s]
[PySceneDetect] Processed 2327 frames in 19.5 seconds (average 119.18 FPS).
[PySceneDetect] Detected 29 scenes, average shot length 3.2 seconds.
[PySceneDetect] Writing scene list to CSV file:
  /content/drive/My Drive/kontext/deold/3/scenes/szf2_2.00x_1600x972_12-Scenes.csv
[PySceneDetect] Scene List:
-----------------------------------------------------------------------
 | Scene # | Start Frame |  Start Time  |  End Frame  |   End Time   |
-----------------------------------------------------------------------
 |      1  |           0 | 00:00:00.000 |          12 | 00:00:00.480 |
 |      2  |          12 | 00:00:00.480 |          28 | 00:00:01.120 |
 |      3  |          28 | 00:00:01.120 |         144 | 00:00:05.760 |
 |      4  |         144 | 00:00:05.760 |         372 | 00:00:14.880 |
 |      5  |         372 | 00:00:14.880 |         388 | 00:00:15.520 |
 |      6  |         388 | 00:00:15.520 |         403 | 00:00:16.120 |
 |      7  |         403 | 00:00:16.120 |         492 | 00:00:19.680 |
 |      8  |         492 | 00:00:19.680 |         528 | 00:00:21.120 |
 |      9  |         528 | 00:00:21.120 |         545 | 00:00:21.800 |
 |     10  |         545 | 00:00:21.800 |         570 | 00:00:22.800 |
 |     11  |         570 | 00:00:22.800 |         623 | 00:00:24.920 |
 |     12  |         623 | 00:00:24.920 |         643 | 00:00:25.720 |
 |     13  |         643 | 00:00:25.720 |         712 | 00:00:28.480 |
 |     14  |         712 | 00:00:28.480 |         761 | 00:00:30.440 |
 |     15  |         761 | 00:00:30.440 |         842 | 00:00:33.680 |
 |     16  |         842 | 00:00:33.680 |         896 | 00:00:35.840 |
 |     17  |         896 | 00:00:35.840 |         978 | 00:00:39.120 |
 |     18  |         978 | 00:00:39.120 |        1134 | 00:00:45.360 |
 |     19  |        1134 | 00:00:45.360 |        1240 | 00:00:49.600 |
 |     20  |        1240 | 00:00:49.600 |        1342 | 00:00:53.680 |
 |     21  |        1342 | 00:00:53.680 |        1429 | 00:00:57.160 |
 |     22  |        1429 | 00:00:57.160 |        1514 | 00:01:00.560 |
 |     23  |        1514 | 00:01:00.560 |        1566 | 00:01:02.640 |
 |     24  |        1566 | 00:01:02.640 |        1633 | 00:01:05.320 |
 |     25  |        1633 | 00:01:05.320 |        1697 | 00:01:07.880 |
 |     26  |        1697 | 00:01:07.880 |        1739 | 00:01:09.560 |
 |     27  |        1739 | 00:01:09.560 |        1764 | 00:01:10.560 |
 |     28  |        1764 | 00:01:10.560 |        1803 | 00:01:12.120 |
 |     29  |        1803 | 00:01:12.120 |        2327 | 00:01:33.080 |
-----------------------------------------------------------------------

[PySceneDetect] Comma-separated timecode list:
  00:00:00.480,00:00:01.120,00:00:05.760,00:00:14.880,00:00:15.520,00:00:16.120,00:00:19.680,00:00:21.120,00:00:21.800,00:00:22.800,00:00:24.920,00:00:25.720,00:00:28.480,00:00:30.440,00:00:33.680,00:00:35.840,00:00:39.120,00:00:45.360,00:00:49.600,00:00:53.680,00:00:57.160,00:01:00.560,00:01:02.640,00:01:05.320,00:01:07.880,00:01:09.560,00:01:10.560,00:01:12.120
[PySceneDetect] Downscale factor set to 1, effective resolution: 1186 x 720
[PySceneDetect] Generating output images (3 per scene)...
100% 87/87 [00:14<00:00,  1.78images/s][PySceneDetect] Splitting input video using ffmpeg, output path template:
  /content/drive/My Drive/kontext/deold/3/scenes/$VIDEO_NAME-Scene-$SCENE_NUMBER.mp4

  0% 0/2327 [00:00<?, ?frame/s]ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --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-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/content/drive/My Drive/kontext/deold/3/szf2_2.00x_1600x972_12.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:01:33.08, start: 0.000000, bitrate: 4363 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1186x720 [SAR 1:1 DAR 593:360], 4354 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 2 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x55c996e72800] using SAR=1/1
[libx264 @ 0x55c996e72800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55c996e72800] profile High, level 3.1
[libx264 @ 0x55c996e72800] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/content/drive/My Drive/kontext/deold/3/scenes/szf2_2.00x_1600x972_12-Scene-001.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuvj420p(pc), 1186x720 [SAR 1:1 DAR 593:360], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 2 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
frame=   12 fps=0.0 q=-1.0 Lsize=     127kB time=00:00:00.46 bitrate=2231.5kbits/s speed=0.963x    
video:125kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.388465%
[libx264 @ 0x55c996e72800] frame I:1     Avg QP:19.63  size: 38314
[libx264 @ 0x55c996e72800] frame P:5     Avg QP:20.30  size: 11700
[libx264 @ 0x55c996e72800] frame B:6     Avg QP:24.11  size:  5019
[libx264 @ 0x55c996e72800] consecutive B-frames: 33.3%  0.0%  0.0% 66.7%
[libx264 @ 0x55c996e72800] mb I  I16..4: 30.3% 41.7% 28.0%
[libx264 @ 0x55c996e72800] mb P  I16..4: 20.3% 11.2%  0.1%  P16..4: 33.1% 12.2%  5.6%  0.0%  0.0%    skip:17.5%
[libx264 @ 0x55c996e72800] mb B  I16..4:  3.0%  3.0%  0.0%  B16..8: 20.6%  5.6%  0.2%  direct:23.4%  skip:44.1%  L0:51.7% L1:38.1% BI:10.2%
[libx264 @ 0x55c996e72800] 8x8 transform intra:39.4% inter:68.5%
[libx264 @ 0x55c996e72800] coded y,uvDC,uvAC intra: 29.7% 42.1% 10.8% inter: 8.8% 52.2% 1.6%
[libx264 @ 0x55c996e72800] i16 v,h,dc,p: 79% 13%  7%  1%
[libx264 @ 0x55c996e72800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 24% 31%  2%  2%  2%  1%  2%  2%
[libx264 @ 0x55c996e72800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 14%  8%  7%  8% 10%  6% 12%  7%
[libx264 @ 0x55c996e72800] i8c dc,h,v,p: 65% 13% 18%  3%
[libx264 @ 0x55c996e72800] Weighted P-Frames: Y:80.0% UV:80.0%
[libx264 @ 0x55c996e72800] kb/s:2115.48
[PySceneDetect] Output from ffmpeg for Scene 1 shown above, splitting remaining scenes...

  1% 12/2327 [00:00<01:51, 20.85frame/s]
  1% 28/2327 [00:01<01:48, 21.25frame/s]
  6% 144/2327 [00:05<01:33, 23.38frame/s]
 16% 372/2327 [00:12<01:16, 25.57frame/s]
 17% 388/2327 [00:13<01:37, 19.85frame/s]
 17% 403/2327 [00:14<01:36, 20.02frame/s]
 21% 492/2327 [00:16<01:21, 22.54frame/s]
 23% 528/2327 [00:18<01:16, 23.46frame/s]
 23% 545/2327 [00:19<01:22, 21.66frame/s]
 24% 570/2327 [00:20<01:19, 22.05frame/s]
 27% 623/2327 [00:22<01:15, 22.43frame/s]
 28% 643/2327 [00:23<01:29, 18.90frame/s]
 31% 712/2327 [00:26<01:18, 20.50frame/s]
 33% 761/2327 [00:28<01:11, 21.86frame/s]
 36% 842/2327 [00:31<01:03, 23.38frame/s]
 39% 896/2327 [00:33<00:58, 24.35frame/s]
 42% 978/2327 [00:36<00:53, 25.16frame/s]
 49% 1134/2327 [00:41<00:45, 26.22frame/s]
 53% 1240/2327 [00:46<00:42, 25.82frame/s]
 58% 1342/2327 [00:49<00:37, 26.33frame/s]
 61% 1429/2327 [00:52<00:33, 26.48frame/s]
 65% 1514/2327 [00:55<00:29, 27.35frame/s]
 67% 1566/2327 [00:58<00:29, 25.90frame/s]
 70% 1633/2327 [01:00<00:26, 26.36frame/s]
 73% 1697/2327 [01:03<00:24, 26.09frame/s]
 75% 1739/2327 [01:04<00:22, 25.73frame/s]
 76% 1764/2327 [01:06<00:26, 21.52frame/s]
 77% 1803/2327 [01:08<00:26, 20.10frame/s]
100% 2327/2327 [01:21<00:00, 23.77frame/s]
[PySceneDetect] Average processing speed 28.64 frames/sec.
[PySceneDetect] Video splitting completed, individual scenes written to disk.

Exception ignored in: <bound method tqdm.__del__ of 100% 2327/2327 [01:21<00:00, 23.77frame/s]>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 931, in __del__
    self.close()
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 1133, in close
    self._decr_instances(self)
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 496, in _decr_instances
    cls.monitor.exit()
  File "/usr/local/lib/python3.6/dist-packages/tqdm/_monitor.py", line 52, in exit
    self.join()
  File "/usr/lib/python3.6/threading.py", line 1053, in join
    raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread

Select and copy good scenes to /goodscenes for both 2 and 3.


In [0]: