Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splitting videos with an analyzed duration only splits within analyzed area #106

Closed
charlesvestal opened this issue Jun 11, 2019 · 6 comments

Comments

@charlesvestal
Copy link

commented Jun 11, 2019

Bug/Issue Description:
Specifying a time to analyze with time --start and --end in conjunction with split-video treats the end time of the analyzed window as the total length of the video, making it unable to be split, either via ffmpeg or mkvmerge.

Required Information:
Provide the following information to assist with reporting the bug:

  1. Provide a full copy of the command line options you are using, for example:

scenedetect -i somevideo.mp4 time -s 00:13:00 -e 00:15:00 detect-threshold split-video -c

  1. Add -v debug -l BUG_REPORT.txt to the beginning of the command, then re-run PySceneDetect and attach the generated BUG_REPORT.txt file.

BUG_REPORT.txt

mkvmerge v34.0.0 ('Sight and Seen') 64-bit
Error: Invalid end time for '--split' in '--split parts:00:12:59.988-00:13:29.726,00:13:29.726-00:02:00.037' (current part: 00:13:29.726-00:02:00.037). The end time must be bigger than the start time.

Expected Behavior:
The analyzed duration should provide timecode for splits, but the split files should be from the entire duration of the input file.

Computing Environment:

  • OS: osx
  • Python Version: 2.7
  • OpenCV Version: 4.1.0_2
@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Jun 11, 2019

Hi @charlesvestal;

Thanks for your bug report! This definitely seems like an issue, I'll do some further investigation and hopefully have a fix for this included in the next release of PySceneDetect.

Just to help with the analysis, do you see the same behaviour if instead of setting the end time, you set the duration instead? (e.g. replace -e 00:15:00 with -d 00:02:00)

Thank you!

@Breakthrough Breakthrough added this to the v0.6 milestone Jun 11, 2019

@charlesvestal

This comment has been minimized.

Copy link
Author

commented Jun 12, 2019

Absolutely! Below is the output for all four scenarios: stream-copy and stream-copy -c in both explicit end and duration variants:

#### Explicit end time, mkvmerge copy stream

Charless-MacBook-Pro:test charles$ scenedetect -i somevideo.mp4 time -s 00:13:00 -e 00:15:00 detect-threshold split-video -c
[PySceneDetect] Loaded 1 video, framerate: 23.98 FPS, resolution: 640 x 360
[PySceneDetect] Downscale factor set to 3, effective resolution: 213 x 120
[PySceneDetect] Duration set, start: 00:12:59.988, duration: None, end: 00:14:59.982.
[PySceneDetect] Video output file name format: $VIDEO_NAME-Scene-$SCENE_NUMBER
[PySceneDetect] Detecting scenes...
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2878/2878 [00:02<00:00, 1142.69frames/s]
[PySceneDetect] Processed 2878 frames in 2.5 seconds (average 1138.74 FPS).
[PySceneDetect] Detected 2 scenes, average shot length 14.9 seconds.
[PySceneDetect] Comma-separated timecode list:
  00:13:29.726
[PySceneDetect] Splitting input video using mkvmerge, output path template:
  $VIDEO_NAME-Scene-$SCENE_NUMBER.mkv
mkvmerge v34.0.0 ('Sight and Seen') 64-bit
Error: Invalid end time for '--split' in '--split parts:00:12:59.988-00:13:29.726,00:13:29.726-00:02:00.037' (current part: 00:13:29.726-00:02:00.037). The end time must be bigger than the start time.

[PySceneDetect] Average processing speed -1163997.34 frames/sec.
[PySceneDetect] Error splitting video (mkvmerge returned 2).
[PySceneDetect] Video splitting completed, individual scenes written to disk.
#### Explicit end time, ffmpeg re encode

Charless-MacBook-Pro:test charles$ scenedetect -i somevideo.mp4 time -s 00:13:00 -e 00:15:00 detect-threshold split-video 
[PySceneDetect] Loaded 1 video, framerate: 23.98 FPS, resolution: 640 x 360
[PySceneDetect] Downscale factor set to 3, effective resolution: 213 x 120
[PySceneDetect] Duration set, start: 00:12:59.988, duration: None, end: 00:14:59.982.
[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%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2878/2878 [00:02<00:00, 1214.69frames/s]
[PySceneDetect] Processed 2878 frames in 2.4 seconds (average 1210.70 FPS).
[PySceneDetect] Detected 2 scenes, average shot length 14.9 seconds.
[PySceneDetect] Comma-separated timecode list:
  00:13:29.726
[PySceneDetect] Splitting input video using ffmpeg, output path template:
  $VIDEO_NAME-Scene-$SCENE_NUMBER.mp4
0frame [00:00, ?frame/s]ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/C-Drive/Media/test/somevideo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:27:00.80, start: 0.000000, bitrate: 611 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 477 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : GPAC ISO Audio Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x7f8a4001f800] using SAR=1/1
[libx264 @ 0x7f8a4001f800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f8a4001f800] profile High, level 3.0
[libx264 @ 0x7f8a4001f800] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=6 lookahead_threads=2 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=23 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 'somevideo-Scene-001.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      encoder         : Lavc58.35.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), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : GPAC ISO Audio Handler
frame=  713 fps=308 q=-1.0 Lsize=    2091kB time=00:00:29.71 bitrate= 576.5kbits/s dup=1 drop=0 speed=12.8x    
video:1539kB audio:530kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.063012%
[libx264 @ 0x7f8a4001f800] frame I:9     Avg QP:19.15  size: 19394
[libx264 @ 0x7f8a4001f800] frame P:221   Avg QP:22.57  size:  4627
[libx264 @ 0x7f8a4001f800] frame B:483   Avg QP:24.54  size:   784
[libx264 @ 0x7f8a4001f800] consecutive B-frames:  6.2%  9.3%  3.8% 80.8%
[libx264 @ 0x7f8a4001f800] mb I  I16..4: 12.1% 21.0% 66.9%
[libx264 @ 0x7f8a4001f800] mb P  I16..4:  4.5%  9.0%  2.1%  P16..4: 41.2% 20.5% 11.0%  0.0%  0.0%    skip:11.7%
[libx264 @ 0x7f8a4001f800] mb B  I16..4:  0.4%  0.3%  0.0%  B16..8: 17.6%  4.5%  0.4%  direct: 5.7%  skip:71.1%  L0:35.4% L1:45.8% BI:18.7%
[libx264 @ 0x7f8a4001f800] 8x8 transform intra:49.8% inter:31.8%
[libx264 @ 0x7f8a4001f800] coded y,uvDC,uvAC intra: 53.6% 70.8% 23.8% inter: 7.6% 13.2% 0.2%
[libx264 @ 0x7f8a4001f800] i16 v,h,dc,p: 46% 24% 17% 13%
[libx264 @ 0x7f8a4001f800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 28% 18%  4%  5%  5%  6%  4%  5%
[libx264 @ 0x7f8a4001f800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 24% 11%  6%  8%  6%  9%  5%  6%
[libx264 @ 0x7f8a4001f800] i8c dc,h,v,p: 46% 26% 21%  7%
[libx264 @ 0x7f8a4001f800] Weighted P-Frames: Y:6.3% UV:3.2%
[libx264 @ 0x7f8a4001f800] kb/s:423.86
[PySceneDetect] Output from ffmpeg for Scene 1 shown above, splitting remaining scenes...
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 727, in main
    ctx.exit()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 504, in exit
    raise Exit(code)
click.exceptions.Exit: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/scenedetect", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/scenedetect/__main__.py", line 58, in main
    cli.main(obj=cli_ctx)   # Parse CLI arguments with registered callbacks.
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 727, in main
    ctx.exit()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 351, in __exit__
    self.close()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 440, in close
    cb()
  File "/usr/local/lib/python3.7/site-packages/scenedetect/cli/context.py", line 436, in process_input
    suppress_output=self.quiet_mode or self.split_quiet)
  File "/usr/local/lib/python3.7/site-packages/scenedetect/video_splitter.py", line 244, in split_video_ffmpeg
    if progress_bar:
ValueError: __len__() should return >= 0

### duration, mkvmerge stream copy

Charless-MacBook-Pro:test charles$ scenedetect -i somevideo.mp4 time -s 00:13:00 -d 00:2:00 detect-threshold split-video -c
[PySceneDetect] Loaded 1 video, framerate: 23.98 FPS, resolution: 640 x 360
[PySceneDetect] Downscale factor set to 3, effective resolution: 213 x 120
[PySceneDetect] Duration set, start: 00:12:59.988, duration: 00:01:59.995, end: None.
[PySceneDetect] Video output file name format: $VIDEO_NAME-Scene-$SCENE_NUMBER
[PySceneDetect] Detecting scenes...
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2878/2878 [00:02<00:00, 1132.49frames/s]
[PySceneDetect] Processed 2878 frames in 2.5 seconds (average 1128.87 FPS).
[PySceneDetect] Detected 2 scenes, average shot length 14.9 seconds.
[PySceneDetect] Comma-separated timecode list:
  00:13:29.726
[PySceneDetect] Splitting input video using mkvmerge, output path template:
  $VIDEO_NAME-Scene-$SCENE_NUMBER.mkv
mkvmerge v34.0.0 ('Sight and Seen') 64-bit
Error: Invalid end time for '--split' in '--split parts:00:12:59.988-00:13:29.726,00:13:29.726-00:02:00.037' (current part: 00:13:29.726-00:02:00.037). The end time must be bigger than the start time.

[PySceneDetect] Average processing speed -855612.93 frames/sec.
[PySceneDetect] Error splitting video (mkvmerge returned 2).
[PySceneDetect] Video splitting completed, individual scenes written to disk.
### duration, ffmpeg re-encode


Charless-MacBook-Pro:test charles$ scenedetect -i somevideo.mp4 time -s 00:13:00 -d 00:2:00 detect-threshold split-video 
[PySceneDetect] Loaded 1 video, framerate: 23.98 FPS, resolution: 640 x 360
[PySceneDetect] Downscale factor set to 3, effective resolution: 213 x 120
[PySceneDetect] Duration set, start: 00:12:59.988, duration: 00:01:59.995, end: None.
[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%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2878/2878 [00:02<00:00, 1118.13frames/s]
[PySceneDetect] Processed 2878 frames in 2.6 seconds (average 1115.08 FPS).
[PySceneDetect] Detected 2 scenes, average shot length 14.9 seconds.
[PySceneDetect] Comma-separated timecode list:
  00:13:29.726
[PySceneDetect] Splitting input video using ffmpeg, output path template:
  $VIDEO_NAME-Scene-$SCENE_NUMBER.mp4
0frame [00:00, ?frame/s]ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/C-Drive/Media/test/somevideo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:27:00.80, start: 0.000000, bitrate: 611 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 477 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : GPAC ISO Audio Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x7fe4ca002000] using SAR=1/1
[libx264 @ 0x7fe4ca002000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fe4ca002000] profile High, level 3.0
[libx264 @ 0x7fe4ca002000] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=6 lookahead_threads=2 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=23 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 'somevideo-Scene-001.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : GPAC ISO Video Handler
      encoder         : Lavc58.35.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), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : GPAC ISO Audio Handler
frame=  713 fps=353 q=-1.0 Lsize=    2091kB time=00:00:29.71 bitrate= 576.5kbits/s dup=1 drop=0 speed=14.7x    
video:1539kB audio:530kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.063012%
[libx264 @ 0x7fe4ca002000] frame I:9     Avg QP:19.15  size: 19394
[libx264 @ 0x7fe4ca002000] frame P:221   Avg QP:22.57  size:  4627
[libx264 @ 0x7fe4ca002000] frame B:483   Avg QP:24.54  size:   784
[libx264 @ 0x7fe4ca002000] consecutive B-frames:  6.2%  9.3%  3.8% 80.8%
[libx264 @ 0x7fe4ca002000] mb I  I16..4: 12.1% 21.0% 66.9%
[libx264 @ 0x7fe4ca002000] mb P  I16..4:  4.5%  9.0%  2.1%  P16..4: 41.2% 20.5% 11.0%  0.0%  0.0%    skip:11.7%
[libx264 @ 0x7fe4ca002000] mb B  I16..4:  0.4%  0.3%  0.0%  B16..8: 17.6%  4.5%  0.4%  direct: 5.7%  skip:71.1%  L0:35.4% L1:45.8% BI:18.7%
[libx264 @ 0x7fe4ca002000] 8x8 transform intra:49.8% inter:31.8%
[libx264 @ 0x7fe4ca002000] coded y,uvDC,uvAC intra: 53.6% 70.8% 23.8% inter: 7.6% 13.2% 0.2%
[libx264 @ 0x7fe4ca002000] i16 v,h,dc,p: 46% 24% 17% 13%
[libx264 @ 0x7fe4ca002000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 28% 18%  4%  5%  5%  6%  4%  5%
[libx264 @ 0x7fe4ca002000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 24% 11%  6%  8%  6%  9%  5%  6%
[libx264 @ 0x7fe4ca002000] i8c dc,h,v,p: 46% 26% 21%  7%
[libx264 @ 0x7fe4ca002000] Weighted P-Frames: Y:6.3% UV:3.2%
[libx264 @ 0x7fe4ca002000] kb/s:423.86
[PySceneDetect] Output from ffmpeg for Scene 1 shown above, splitting remaining scenes...
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 727, in main
    ctx.exit()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 504, in exit
    raise Exit(code)
click.exceptions.Exit: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/scenedetect", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/scenedetect/__main__.py", line 58, in main
    cli.main(obj=cli_ctx)   # Parse CLI arguments with registered callbacks.
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 727, in main
    ctx.exit()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 351, in __exit__
    self.close()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 440, in close
    cb()
  File "/usr/local/lib/python3.7/site-packages/scenedetect/cli/context.py", line 436, in process_input
    suppress_output=self.quiet_mode or self.split_quiet)
  File "/usr/local/lib/python3.7/site-packages/scenedetect/video_splitter.py", line 244, in split_video_ffmpeg
    if progress_bar:
ValueError: __len__() should return >= 0

Thanks for such a great tool!

@snwfdhmp

This comment has been minimized.

Copy link

commented Aug 26, 2019

Having same issue here

@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Aug 31, 2019

Hey @charlesvestal / @snwfdhmp;

I just pushed a fix for this to master just now (d097275). Feel free to download & install a copy locally to get a patched version up and running until this is available on pip (I'll likely publish v0.5.2 by mid September).

I also updated the relevant unit tests to ensure that this case is specifically checked for now (namely, that all scenes returned by the SceneManager must be in ascending order, and the start timecode must be smaller than the end timecode).

Thanks again @charlesvestal for your well-written and extensive report. All of the included information allowed me to make a much more focused and isolated root cause analysis, as well as updating the unit tests to prevent regressions going forwards. Much appreciated!

@charlesvestal

This comment has been minimized.

Copy link
Author

commented Aug 31, 2019

Finally had a chance to test this (sorry!).

While i'm now able to succesfully run the command, the analyzed area is treated as the whole area to split. My impression was that the analyzed area is where you would look for splits but the entire video would still be split. Is that incorrect?

i.e. i know there's a break between 13m and 15m, but the video is 30m long, I want to limit the analysis for speed but still have two roughly 15m chunks.

@charlesvestal

This comment has been minimized.

Copy link
Author

commented Aug 31, 2019

I think I'm wrong, and using the start and end time of the process duration as different from the clip duration is likely another feature request. ;) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.