Getting frames from CVAT image annotation

248 Views Asked by At

I used CVAT to annotate a video, specifically for the Yolo format. However I also want to get the frames for the video I annotated, I tried to get the frames from the VLC media player, but it is giving me 1109 frames when I had actually annotated 1541 frames in the CVAT software.

I used the following command

ffmpeg -i path/to/your/video -start_number 0 -b:v 10000k -vsync 0 -an -y -q:v 16 images/%d.jpg

but I am getting the following error :

ffmpeg version 5.1.2-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
-vsync is deprecated. Use -fps_mode
Passing a number to -vsync is deprecated, use a string argument as described in the manual.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\Aditya Kalhan\Downloads\odonil.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp41isom
    creation_time   : 2023-08-22T16:49:13.000000Z
  Duration: 00:01:02.78, start: 0.000000, bitrate: 8095 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/bt709/reserved, progressive), 1280x720 [SAR 1:1 DAR 16:9], 7886 kb/s, 29.89 fps, 30 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2023-08-22T16:49:13.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      creation_time   : 2023-08-22T16:49:13.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'images/%d.jpg':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp41isom
    encoder         : Lavf59.27.100
  Stream #0:0(und): Video: mjpeg, yuvj420p(pc, bt470bg/bt709/reserved, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 10000 kb/s, 30 fps, 30 tbn (default)
    Metadata:
      creation_time   : 2023-08-22T16:49:13.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.37.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/10000000 buffer size: 0 vbv_delay: N/A
[image2 @ 000002024a04d440] Could not open file : images/0.jpgA speed=   0x
av_interleaved_write_frame(): I/O error
[image2 @ 000002024a04d440] Could not open file : images/0.jpg
av_interleaved_write_frame(): I/O error
[image2 @ 000002024a04d440] Could not open file : images/0.jpg
av_interleaved_write_frame(): I/O error
[image2 @ 000002024a04d440] Could not open file : images/0.jpg
av_interleaved_write_frame(): I/O error
[image2 @ 000002024a04d440] Could not open file : images/0.jpg
av_interleaved_write_frame(): I/O error
frame=    5 fps=0.0 q=16.0 Lsize=N/A time=00:00:00.16 bitrate=N/A speed= 4.8x
video:51kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

I then used this command :

ffmpeg -i path/to/your/video -start_number 0 -b:v 10000k -vsync 0 -an -y -q:v 16 images2/frame_%06d.jpg

and got the following error :

ffmpeg version 5.1.2-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
-vsync is deprecated. Use -fps_mode
Passing a number to -vsync is deprecated, use a string argument as described in the manual.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\Aditya Kalhan\Downloads\odonil.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp41isom
    creation_time   : 2023-08-22T16:49:13.000000Z
  Duration: 00:01:02.78, start: 0.000000, bitrate: 8095 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/bt709/reserved, progressive), 1280x720 [SAR 1:1 DAR 16:9], 7886 kb/s, 29.89 fps, 30 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2023-08-22T16:49:13.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      creation_time   : 2023-08-22T16:49:13.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'images2/frame_%06d.jpg':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp41isom
    encoder         : Lavf59.27.100
  Stream #0:0(und): Video: mjpeg, yuvj420p(pc, bt470bg/bt709/reserved, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 10000 kb/s, 30 fps, 30 tbn (default)
    Metadata:
      creation_time   : 2023-08-22T16:49:13.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.37.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/10000000 buffer size: 0 vbv_delay: N/A
[image2 @ 000001fcb198d240] Could not open file : images2/frame_000000.jpgx
av_interleaved_write_frame(): I/O error
[image2 @ 000001fcb198d240] Could not open file : images2/frame_000000.jpg
av_interleaved_write_frame(): I/O error
[image2 @ 000001fcb198d240] Could not open file : images2/frame_000000.jpg
av_interleaved_write_frame(): I/O error
[image2 @ 000001fcb198d240] Could not open file : images2/frame_000000.jpg
av_interleaved_write_frame(): I/O error
frame=    4 fps=0.0 q=16.0 Lsize=N/A time=00:00:00.13 bitrate=N/A speed=1.91x
video:41kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
1

There are 1 best solutions below

0
On

Did you try using the Export Task Dataset drop down menu to the top right of the Task? It allows you to export annotation as well as images in different formats.