ultralytics icon indicating copy to clipboard operation
ultralytics copied to clipboard

Video prediction hasn't saved: timebase 500/105611 not supported by MPEG 4 standard

Open plashchynski opened this issue 3 years ago • 2 comments

Search before asking

  • [X] I have searched the YOLOv8 issues and found no similar bug report.

YOLOv8 Component

Detection

Bug

The prediction from a video file source:

model = YOLO("runs/train24/weights/best.pt")
model.predict(source="20211103_163810000_iOS.MOV", save=True)

does not save results and prints the following warning:

Ultralytics YOLOv8.0.5 🚀 Python-3.10.8 torch-1.13.0+cu117 CUDA:0 (Tesla T4, 15110MiB)
Fusing layers... 
YOLOv8x-seg summary: 295 layers, 71725471 parameters, 0 gradients, 343.7 GFLOPs
[mpeg4 @ 0x55d5d3ae7d00] timebase 500/105611 not supported by MPEG 4 standard, the maximum admitted value for the timebase denominator is 65535
video 1/1 (1/3628) 20211103_163810000_iOS.MOV: 640x384 1 test, 49.3ms
[ERROR:[email protected]] global cap_ffmpeg_impl.hpp:3049 open Could not open codec mpeg4, error: Unspecified error (-22)
[ERROR:[email protected]] global cap_ffmpeg_impl.hpp:3066 open VIDEOIO/FFMPEG: Failed to initialize VideoWriter

probably because of a high FPS in the source video:

ffprobe version 4.3.5-0+deb11u1 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20211103_163810000_iOS.MOV':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2021-11-03T16:38:10.000000Z
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 12 Pro
    com.apple.quicktime.software: 15.1
    com.apple.quicktime.creationdate: 2021-11-03T18:38:10+0200
  Duration: 00:00:17.18, start: 0.000000, bitrate: 56647 kb/s
    Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 1920x1080, 56402 kb/s, 211.22 fps, 240 tbr, 2400 tbn, 2400 tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2021-11-03T16:38:10.000000Z
      handler_name    : Core Media Video
      encoder         : HEVC
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 178 kb/s (default)
    Metadata:
      creation_time   : 2021-11-03T16:38:10.000000Z
      handler_name    : Core Media Audio
root@sagemaker-base-pyth-ml-g4dn-xlarge-fe73428bcdef8b4a445216f427c5:~# ffprobe 20211103_163810000_iOS.MOV | grep Stream
ffprobe version 4.3.5-0+deb11u1 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20211103_163810000_iOS.MOV':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2021-11-03T16:38:10.000000Z
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 12 Pro
    com.apple.quicktime.software: 15.1
    com.apple.quicktime.creationdate: 2021-11-03T18:38:10+0200
  Duration: 00:00:17.18, start: 0.000000, bitrate: 56647 kb/s
    Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 1920x1080, 56402 kb/s, 211.22 fps, 240 tbr, 2400 tbn, 2400 tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2021-11-03T16:38:10.000000Z
      handler_name    : Core Media Video
      encoder         : HEVC
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 178 kb/s (default)
    Metadata:
      creation_time   : 2021-11-03T16:38:10.000000Z
      handler_name    : Core Media Audio
root@sagemaker-base-pyth-ml-g4dn-xlarge-fe73428bcdef8b4a445216f427c5:~# ffprobe 20211103_163810000_iOS.MOV
ffprobe version 4.3.5-0+deb11u1 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20211103_163810000_iOS.MOV':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2021-11-03T16:38:10.000000Z
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 12 Pro
    com.apple.quicktime.software: 15.1
    com.apple.quicktime.creationdate: 2021-11-03T18:38:10+0200
  Duration: 00:00:17.18, start: 0.000000, bitrate: 56647 kb/s
    Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 1920x1080, 56402 kb/s, 211.22 fps, 240 tbr, 2400 tbn, 2400 tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2021-11-03T16:38:10.000000Z
      handler_name    : Core Media Video
      encoder         : HEVC
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 178 kb/s (default)
    Metadata:
      creation_time   : 2021-11-03T16:38:10.000000Z
      handler_name    : Core Media Audio

Environment

  • YOLO from the main branch of https://github.com/ultralytics/ultralytics as well as the pip ultralytics==8.0.5
  • ffmpeg version 4.3.5-0+deb11u1

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

  • [X] Yes I'd like to help by submitting a PR!

plashchynski avatar Jan 12 '23 18:01 plashchynski

@plashchynski hi, it looks like a video format specific issue. I've also tested a video using the same code as your except the video_path and the saving works fine to me. pic-full-230113-1022-14 left in the screen is the saved video being played and the test.mp4 in the right is the saved video.

Laughing-q avatar Jan 13 '23 02:01 Laughing-q

Hi @Laughing-q I've managed to find the cause of this bug. The problem is that the fps value turned to be a float for some source files. I've submitted a #341 PR with a fix. It's easy to reproduce:

Screenshot 2023-01-13 at 20 25 46

plashchynski avatar Jan 13 '23 17:01 plashchynski

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

  • Docs: https://docs.ultralytics.com
  • HUB: https://hub.ultralytics.com
  • Community: https://community.ultralytics.com

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO 🚀 and Vision AI ⭐

github-actions[bot] avatar Mar 23 '23 00:03 github-actions[bot]