When I try to decode videos using libmpeg2 I get errors 31c and 301, I cannot find them in code and output video is broken.
I have downloaded libmpeg2 from here. To reproduce this on x86, a build directory was made and ran cmake and then make.
For test video I downloaded this and for config file I used:
--input sample.mpeg
--output out.yuv
--save_output 1
--num_frames -1
--chroma_format YUV_420P
--share_display_buf 0
--max_wd 1280
--max_ht 720
--num_cores 1
--loopback 0
--display 0
--fps 30
--arch X86_GENERIC
--soc GENERIC
When I run ./mpeg2dec x86_test.cfg I get this output:
FrameNum: 1 TimeTaken(microsec): 400 AvgTime: 400 PeakAvgTimeMax: 50 Output: 0 NumBytes: 1993
FrameNum: 2 TimeTaken(microsec): 1942 AvgTime: 1171 PeakAvgTimeMax: 292 Output: 0 NumBytes: 143360
FrameNum: 3 TimeTaken(microsec): 3644 AvgTime: 1995 PeakAvgTimeMax: 748 Output: 1 NumBytes: 278528
FrameNum: 4 TimeTaken(microsec): 2374 AvgTime: 2090 PeakAvgTimeMax: 1045 Output: 1 NumBytes: 147456
FrameNum: 5 TimeTaken(microsec): 3193 AvgTime: 2310 PeakAvgTimeMax: 1444 Output: 1 NumBytes: 77824
FrameNum: 6 TimeTaken(microsec): 1274 AvgTime: 2137 PeakAvgTimeMax: 1603 Output: 1 NumBytes: 36864
FrameNum: 7 TimeTaken(microsec): 788 AvgTime: 1945 PeakAvgTimeMax: 1701 Output: 0 NumBytes: 12291
Error in video Frame decode : ret 1 Error 301
FrameNum: 8 TimeTaken(microsec): 996 AvgTime: 1826 PeakAvgTimeMax: 1826 Output: 1 NumBytes: 18429
FrameNum: 9 TimeTaken(microsec): 3218 AvgTime: 1981 PeakAvgTimeMax: 2178 Output: 1 NumBytes: 14336
FrameNum: 10 TimeTaken(microsec): 1688 AvgTime: 1951 PeakAvgTimeMax: 2178 Output: 1 NumBytes: 4096
FrameNum: 11 TimeTaken(microsec): 1436 AvgTime: 1904 PeakAvgTimeMax: 2178 Output: 1 NumBytes: 6144
***
FrameNum: 367 TimeTaken(microsec): 1570 AvgTime: 1549 PeakAvgTimeMax: 2218 Output: 1 NumBytes: 6132
FrameNum: 368 TimeTaken(microsec): 1666 AvgTime: 1549 PeakAvgTimeMax: 2218 Output: 1 NumBytes: 6144
FrameNum: 369 TimeTaken(microsec): 1091 AvgTime: 1548 PeakAvgTimeMax: 2218 Output: 1 NumBytes: 4096
FrameNum: 370 TimeTaken(microsec): 784 AvgTime: 1546 PeakAvgTimeMax: 2218 Output: 0 NumBytes: 11212
Error in video Frame decode : ret 1 Error 31c
FrameNum: 371 TimeTaken(microsec): 1127 AvgTime: 1545 PeakAvgTimeMax: 2218 Output: 1 NumBytes: 1076
FrameNum: 372 TimeTaken(microsec): 634 AvgTime: 1542 PeakAvgTimeMax: 2218 Output: 1 NumBytes: 6144
FrameNum: 373 TimeTaken(microsec): 1046 AvgTime: 1541 PeakAvgTimeMax: 2218 Output: 1 NumBytes: 4096
FrameNum: 374 TimeTaken(microsec): 2412 AvgTime: 1543 PeakAvgTimeMax: 2218 Output: 1 NumBytes: 43008
***
Summary
Input filename : sample.mpeg
Output Width : 1280
Output Height : 720
Bitrate @ 30 fps(mbps) : 2.12
Average decode time(micro sec) : 1497
Avg Peak decode time( 8 frames) : 5334
FPS achieved (with format conv) : 667.96
So I get these two error which I cannot find in code, the decoded video is broken and summary numbers aren't correct. I play .yuv file using ffplay -video_size 1280x720 -pixel_format yuv420p -f rawvideo out.yuv.
The error codes are printed in hexadecimal and the error codes 0x301 and 0x31c are the values of enumerated constants
IMPEG2D_UNKNOWN_ERRORandIMPEG2D_INVALID_PIC_TYPEdefined in "decoder/impeg2d.h":More constants follow …
This is the 28th constant in the enumeration:
More constants follow …
IVD_DUMMY_ELEMENT_FOR_CODEC_EXTENSIONSis an enumerated constant defined in "decoder/ivd.h":So:
IMPEG2D_UNKNOWN_ERROR= 0x301IMPEG2D_INVALID_PIC_TYPE= 0x31c