chaoyuaw / pytorch-coviar

Compressed Video Action Recognition
https://www.cs.utexas.edu/~cywu/projects/coviar/
GNU Lesser General Public License v2.1
502 stars 126 forks source link

Training Error #1

Open tzzcl opened 6 years ago

tzzcl commented 6 years ago

Hi,

I tried your code to reproduce the coviar result in your paper.

I followed all your instructions in GET_START.md But I met this error: v_frame_idx = random.randint(seg_begin,seg_end - 1) ... ValueError: empty range for randrange() (1,0,-1)

It seems there is something wrong with the video processing.

Can you give me some hints?

chaoyuaw commented 6 years ago

It looks like it's due to a short or 0 "num_frames". With UCF-101 or HMDB this shouldn't happen. Did you follow the same FFmpeg version, and use ./reencode.sh to encode the videos?

Thanks!

tzzcl commented 6 years ago

Thanks for your reply!

I just use the same FFmpeg version.

But I find that the format is rawvideo in the ./reencode.sh.

and the decoder flag is AV_CODEC_ID_MPEG4 in coviar_data_loader.c

when I change it to AV_CODEC_ID_RAWVIDEO, it seems works for count frames, but with errors when extracting the frames.

chaoyuaw commented 6 years ago

I did intend to use mpeg4 "raw" videos. Namely, videos obtained with the following command ffmpeg -i input.mp4 -c:v -c:v mpeg4 -f rawvideo output.mp4

Can you please use, e.g. ffprobe, to get more information about your encoded videos?

tzzcl commented 6 years ago

Here's the output of ffprobe (with user installed git version):

zhangcl2@lamda6-GPU4:/data/zhangcl2/UCF-101-mpeg/ApplyEyeMakeup$ /data/zhangcl2/ffmpeg/bin/ffprobe v_ApplyEyeMakeup_g01_c01.mp4 
ffprobe version N-90418-g74c6a6d Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --prefix=/data/zhangcl2/ffmpeg --enable-pic --disable-yasm --enable-shared
  libavutil      56. 11.100 / 56. 11.100
  libavcodec     58. 15.100 / 58. 15.100
  libavformat    58. 10.100 / 58. 10.100
  libavdevice    58.  2.100 / 58.  2.100
  libavfilter     7. 13.100 /  7. 13.100
  libswscale      5.  0.102 /  5.  0.102
  libswresample   3.  0.101 /  3.  0.101
Input #0, m4v, from 'v_ApplyEyeMakeup_g01_c01.mp4':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 340x256 [SAR 1:1 DAR 85:64], 25 tbr, 1200k tbn, 25 tbc

you can see that the duration is 0s.

chaoyuaw commented 6 years ago

Thanks for the information. Yes, it looks like the issue is the failure of encoding. If this specific version of FFmpeg doesn't work in your environment for some reason, maybe you can considering trying any other FFmpeg version that works in your environment. My understanding is that as long as they're "raw mpeg4" videos, the decoder should work fine.

kinglong1 commented 5 years ago

Dear friend, I have faced the same problem as you. "Decoding video failed" and "Could not allocate video parser context". I wonder if you have solved those two problems. Could you just give me some help? Thank you very much. qq 20190114221301

filipetrocadoferreira commented 5 years ago

Having the same problem

tzzcl commented 5 years ago

To who have the same problem with me, I use these strategies:

  1. Change code to pCodec = avcodec_find_decoder(AV_CODEC_ID_RAWVIDEO); from // pCodec = avcodec_find_decoder(AV_CODEC_ID_H264);
  2. Change reencode.sh /data/zhangcl2/ffmpeg/bin/ffmpeg -i ${inname} -vf scale=340:256,setsar=1:1 -q:v 1 -c:v mpeg4 -f rawvideo ${outname} from `

    /data/zhangcl2/ffmpeg/bin/ffmpeg -i ${inname} -vf scale=340:256,setsar=1:1 -q:v 1 -c:v mpeg4 ${outname}

    `

Hope this may help!