LukasBommes / mv-extractor

Extract frames and motion vectors from H.264 and MPEG-4 encoded video.
MIT License
305 stars 60 forks source link

Source code installation failure: AVPacket struct member error #31

Closed qinziqiao closed 1 month ago

qinziqiao commented 1 year ago

Seek help. I have installed opencv and ffmpeg source code, but encountered the following problems when run "python -m pip install .":

src/mvextractor/video_cap.cpp:218:41: error: ‘AVPacket’ {aka ‘struct AVPacket’} has no member named ‘synced’ if (this->is_rtsp && packet.synced) { ^~ src/mvextractor/video_cap.cpp:222:32: error: ‘AVPacket’ {aka ‘struct AVPacket’} has no member named ‘last_rtcp_ntp_time’ ntp2tv(&packet.last_rtcp_ntp_time, &tv); ^~~~~~ src/mvextractor/video_cap.cpp:223:51: error: ‘AVPacket’ {aka ‘struct AVPacket’} has no member named ‘timestamp’ double rtp_diff = (double)(packet.timestamp - packet.last_rtcp_timestamp) / 90000.0; ^~~~~ src/mvextractor/video_cap.cpp:223:70: error: ‘AVPacket’ {aka ‘struct AVPacket’} has no member named ‘last_rtcp_timestamp’ double rtp_diff = (double)(packet.timestamp - packet.last_rtcp_timestamp) / 90000.0;

I check the AVPacket struct of the "ffmpeg_build/include/libavcodec/avcodec.h" file, and found they really don't exist either in the new version (ffmpeg 5.0, ffmpeg 4.1) or the old version ( ffmpeg 3.4).

xizaoqu commented 1 year ago

Same question, have you figured it out?

xizaoqu commented 1 year ago

Seek help. I have installed opencv and ffmpeg source code, but encountered the following problems when run "python -m pip install .":

src/mvextractor/video_cap.cpp:218:41: error: ‘AVPacket’ {aka ‘struct AVPacket’} has no member named ‘synced’ if (this->is_rtsp && packet.synced) { ^~ src/mvextractor/video_cap.cpp:222:32: error: ‘AVPacket’ {aka ‘struct AVPacket’} has no member named ‘last_rtcp_ntp_time’ ntp2tv(&packet.last_rtcp_ntp_time, &tv); ^~~~~~ src/mvextractor/video_cap.cpp:223:51: error: ‘AVPacket’ {aka ‘struct AVPacket’} has no member named ‘timestamp’ double rtp_diff = (double)(packet.timestamp - packet.last_rtcp_timestamp) / 90000.0; ^~~~~ src/mvextractor/video_cap.cpp:223:70: error: ‘AVPacket’ {aka ‘struct AVPacket’} has no member named ‘last_rtcp_timestamp’ double rtp_diff = (double)(packet.timestamp - packet.last_rtcp_timestamp) / 90000.0;

I check the AVPacket struct of the "ffmpeg_build/include/libavcodec/avcodec.h" file, and found they really don't exist either in the new version (ffmpeg 5.0, ffmpeg 4.1) or the old version ( ffmpeg 3.4).

Actually, this repo provides the patch in ffmpeg_patch

vedantroy commented 7 months ago

I used the custom FFMPEG installer script, but that doesn't seem to install libav-format. I can install libav-format using Ubuntu's package manager, but I think that installs the unpatched version.

choasma commented 3 months ago

That's the great point @xizaoqu. Had the same issue, and execute the patch script here solved the problem, actually it just copy the patched three files into the installed path. Probably README file should update about this

LukasBommes commented 1 month ago

The patch is installed in the Docker image here. I could add this to the readme but thought everyone could just read the Dockerfile to understand the installation procedure.