chaoyuaw / pytorch-coviar

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

Could not allocate video parser context Decoding video failed. #71

Open OrdinaryCrazy opened 5 years ago

OrdinaryCrazy commented 5 years ago

I do not know why I fail to get residual from mp4:

(base) jingtun@winnie:~/mvff-sideversions$ sudo python3 VID_MV_Extractor.py
ffmpeg version N-90418-g74c6a6d Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
  configuration: --enable-pic --disable-yasm --enable-shared --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-shared --enable-openssl --enable-gpl
  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
  libpostproc    55.  0.100 / 55.  0.100
Input #0, image2, from '/home/ssd1T_1/boyuan/ImageNetVID/ILSVRC2015/Data/VID/train/ILSVRC2015_VID_train_0001/ILSVRC2015_train_00259005/*.JPEG':
  Duration: 00:00:01.33, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 30 tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 0xfb8cc0] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0xec6440] using SAR=1/1
[libx264 @ 0xec6440] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 0xec6440] profile Progressive High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0xec6440] 264 - core 157 r2969 d4099dd - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=22 lookahead_threads=3 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/home/ssd1T_1/boyuan/ImageNetVID/ILSVRC2015/Res/VID/train/ILSVRC2015_VID_train_0001/ILSVRC2015_train_00259005/out.mp4':
  Metadata:
    encoder         : Lavf58.10.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.15.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=   40 fps= 31 q=-1.0 Lsize=     287kB time=00:00:01.23 bitrate=1903.6kbits/s speed=0.951x
video:285kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.453525%
[libx264 @ 0xec6440] frame I:1     Avg QP:18.79  size:  8506
[libx264 @ 0xec6440] frame P:10    Avg QP:21.46  size:  7950
[libx264 @ 0xec6440] frame B:29    Avg QP:22.31  size:  7016
[libx264 @ 0xec6440] consecutive B-frames:  2.5%  0.0%  7.5% 90.0%
[libx264 @ 0xec6440] mb I  I16..4: 78.4% 21.3%  0.2%
[libx264 @ 0xec6440] mb P  I16..4: 41.0% 28.9%  0.6%  P16..4:  1.5%  0.9%  0.4%  0.0%  0.0%    skip:26.7%
[libx264 @ 0xec6440] mb B  I16..4: 18.6% 28.4%  0.1%  B16..8:  6.3%  3.4%  1.1%  direct: 1.7%  skip:40.5%  L0:49.3% L1:42.0% BI: 8.7%
[libx264 @ 0xec6440] 8x8 transform intra:52.2% inter:90.5%
[libx264 @ 0xec6440] coded y,uvDC,uvAC intra: 25.7% 0.0% 0.0% inter: 7.2% 0.0% 0.0%
[libx264 @ 0xec6440] i16 v,h,dc,p: 45% 35% 20%  0%
[libx264 @ 0xec6440] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 24% 46%  3%  0%  0%  0%  0%  3%
[libx264 @ 0xec6440] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 55% 24% 11%  1%  2%  3%  2%  1%  1%
[libx264 @ 0xec6440] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0xec6440] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0xec6440] ref P L0: 58.8%  8.2% 23.4%  9.6%
[libx264 @ 0xec6440] ref B L0: 80.9% 15.7%  3.4%
[libx264 @ 0xec6440] ref B L1: 90.9%  9.1%
[libx264 @ 0xec6440] kb/s:1748.80
ffmpeg version N-90418-g74c6a6d Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
  configuration: --enable-pic --disable-yasm --enable-shared --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-shared --enable-openssl --enable-gpl
  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
  libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/ssd1T_1/boyuan/ImageNetVID/ILSVRC2015/Res/VID/train/ILSVRC2015_VID_train_0001/ILSVRC2015_train_00259005/out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.10.100
  Duration: 00:00:01.33, start: 0.000000, bitrate: 1760 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1752 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, rawvideo, to '/home/ssd1T_1/boyuan/ImageNetVID/ILSVRC2015/Res/VID/train/ILSVRC2015_VID_train_0001/ILSVRC2015_train_00259005/output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.10.100
    Stream #0:0(und): Video: mpeg4, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.15.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame=   40 fps=0.0 q=31.0 Lsize=     231kB time=00:00:01.33 bitrate=1418.6kbits/s speed=5.04x
video:231kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Could not allocate video parser context
Decoding video failed.
path_to_video:!!!/home/ssd1T_1/boyuan/ImageNetVID/ILSVRC2015/Res/VID/train/ILSVRC2015_VID_train_0001/ILSVRC2015_train_00259005/output.mp4
Error

['1', '4', '6', '9', '12', '14', '17', '20', '22', '25', '28', '30', '33', '36', '38']
Traceback (most recent call last):
  File "VID_MV_Extractor.py", line 47, in video2mv_collection
    mv = mv.astype('int8')
AttributeError: 'NoneType' object has no attribute 'astype'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "VID_MV_Extractor.py", line 83, in mv_extraction_train_part
    mv_extraction_per_video_collection(path_to_video_directory, target_directory, collection)
  File "VID_MV_Extractor.py", line 63, in mv_extraction_per_video_collection
    video2mv_collection(path_to_video, target_directory, collection)
  File "VID_MV_Extractor.py", line 53, in video2mv_collection
    error_recorder.append(mv_path)
UnboundLocalError: local variable 'mv_path' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "VID_MV_Extractor.py", line 97, in <module>
    wrapper_collection()
  File "VID_MV_Extractor.py", line 94, in wrapper_collection
    mv_extraction_train_part(frame_segment_id_collection)
  File "VID_MV_Extractor.py", line 86, in mv_extraction_train_part
    print("Error: path_to_video_directory: " + path_to_video_directory + ", target_directory: " + target_directory + ", collection: " + collection + "\n\n\n")
TypeError: Can't convert 'list' object to str implicitly

error comes from following code:

def video2mv_collection(path_to_video, target_directory, collection):
    # num_group = coviar.get_num_gops(path_to_video)
    for idx in collection:
        idx_int = int(idx)
        group_idx = idx_int // 12
        frame_idx = idx_int % 12 + 5
        try:
            mv = coviar.load(path_to_video, group_idx, frame_idx, 2, True)
            print("path_to_video:!!!" + path_to_video)
            mv = mv.astype('int8')
            mv_path = '%06d' % idx_int
            mv_path = target_directory + '/' + mv_path + '.pkl'
            pickle.dump(mv, open(mv_path, 'wb'), protocol=2)
        except:
            print("Error\n\n\n\n\n")
            error_recorder.append(mv_path)
            return

        loaded_mv = load_mv(mv_path)
        assert (loaded_mv == mv).all()
OrdinaryCrazy commented 5 years ago

modified setup.py or original setup.py both do not work for this problem

GoogQing commented 2 years ago

modified setup.py or original setup.py both do not work for this problem

Hi, have you solved it? I face the same problem

JunLiangZ commented 2 years ago

Hi, have you solved it? I face the same problem