antingshen/BeaverDam

adding video

Closed this issue · 5 comments

It is pretty unclear how to add a video .
Some explicit instructions for those like me who are baffled after install:

  1. start the venv:
    source venv/bin/activate
  2. add your video to BeaverDam/annotator/static/videos (I think this is right, not that there is any documentation on it...)

After doing those I hit :

Exception Value:
unsupported operand type(s) for +: 'Exception' and 'str'
Exception Location: /home/jeremy/sw/BeaverDam/annotator/models.py in url, line 43

where line 43 is
raise Exception('Video {0} does not have a filename, host or
image_list. Possible fixes: \n1) Place {0}.mp4 into static/videos to serve locally. \n2) Update the filename & host fields of the Video with id={0}'.format(self.id)) + self.filename

So it appears there is a parenthesis problem here, the line should read

raise Exception('Video {0} does not have a filename, host or
image_list. Possible fixes: \n1) Place {0}.mp4 into static/videos to serve locally. \n2) Update the filename & host fields of the Video with id={0}'.format(self.id) + self.filename )

after fixing that in models.py, I get an error complaining about the filename. I will try changing to 149.mp4 as the error seems to expect that name.

Putting in my video as 149.mp4 allows the video tagging window to open without error, but no frames are available (black frame is shown) . Forward/fast forward is not possible, although tagging is possible.

Thanks for finding that!

It sounds like a possible problem is that your Video object is correct, but your video mp4 is not supported by your browser. Is your video H.264 encoded?

If that doesn't work, make sure you have:

  • The video either on a CDN or in the static folder. Test this by accessing /static/videos/<id>.mp4. You should see your video there.
  • A Video object that has a matching ID with the mp4 filename, or explicitly specify the url of the video above by filling out video.host and video.filename. For example, host = '/static/videos/', filename = '149.mp4'.

I tried with a h.264 encoded video and it seems to work fine. If I want to implement tracking to update the boxes in subsequent frames, can you suggest where I would integrate this code?
Thanks

Assuming your tracking code needs to be implemented server-side, I'd add it as an api in another file in /annotator, following the /annotator/services example. You'd need to add it to /beaverdam/urls.py too.

If your tracking is complex (or will have other forms of semi-automated labeling), you could also add a top level Django app of its own.

If your tracking code is client-side, then it'd go in a javascript file in annotator.

I'm happy to help out too, as I've been meaning to add tracking at some point.

It looks like i can access the boundingbox data server side by looking at the file that is dumped . I did run into another issue though that the first 10 seconds or so of one video dont respond to fwd/rev, and after cutting those seconds out the entire remaining video has the same problem...150.mp4 is the one where initial seconds dont update whereas if I drag scrollbar to middle of video then fwd/rev starts to work

(venv) jeremy@jr:~/sw/BeaverDam/annotator/static/videos$ ls -ltr
total 59560
-rw-rw-r-- 1 jeremy jeremy  2063958 Jun 28  2016 0.mp4
-rw-rw-r-- 1 jeremy jeremy 12455121 Jun 21 18:49 149.mp4
-rw-rw-r-- 1 jeremy jeremy 14827008 Jun 22 10:50 150_all.mp4
-rw-rw-r-- 1 jeremy jeremy 15816902 Jun 25 11:26 150.mp4
-rw-rw-r-- 1 jeremy jeremy 15816902 Jun 25 11:30 151.mp4
(venv) jeremy@jr:~/sw/BeaverDam/annotator/static/videos$ ffmpeg -i 150.mp4 
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 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 '150.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:00:50.08, start: 0.000000, bitrate: 2526 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2523 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
At least one output file must be specified
(venv) jeremy@jr:~/sw/BeaverDam/annotator/static/videos$