Opened 10 years ago

Closed 10 years ago

#3093 closed defect (fixed)

filtering examples are broken

Reported by: a Owned by:
Priority: important Component: documentation
Version: git-master Keywords: examples
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug:

I build the filtering_video example code using latest
ffmpeg-20131026-git-c78a416-win32-dev version of ffmpeg on windows 7 platform using Micro Soft Visual Studio 2012.

When i try to use .mpg video stream with this example i get following crash at the "av_frame_free(&frame);" call in main with the message
==============================================================
First-chance exception at 0x52B832F8 (avutil-52.dll) in filtering_video.exe: 0xC0000005: Access violation reading location 0xFEEEFEF2.
==============================================================

Please let me know if there is something else which needs to be performed to avoid this crash for .mpg files

How to reproduce:

% filtering_video.exe Tank_T80U.mpg

ffmpeg version -- ffmpeg-20131026-git-c78a416-win32-dev
built on -- Windows 7 MSVC Express 2012

Please let me know if there is a work around to avoid this memory crash issue?

Attachments (1)

Tank_T80U--.mpg (2.3 MB ) - added by a 10 years ago.
mpeg file for memory crash issue with ffpmpeg filtering_video example code

Change History (15)

by a, 10 years ago

Attachment: Tank_T80U--.mpg added

mpeg file for memory crash issue with ffpmpeg filtering_video example code

comment:1 by Carl Eugen Hoyos, 10 years ago

Resolution: duplicate
Status: newclosed

Looks like a duplicate of ticket #3092.

comment:2 by Clément Bœsch, 10 years ago

Keywords: examples added
Priority: normalimportant
Resolution: duplicate
Status: closedreopened

I don't think so. Those filtering examples are broken because of the half switch to the new frame counting API.

Edit: ah, sorry, I thought the other ticket was about swscale; this ticket looks better, I'd close the other instead.

Last edited 10 years ago by Clément Bœsch (previous) (diff)

in reply to:  2 comment:3 by Carl Eugen Hoyos, 10 years ago

Replying to ubitux:

Edit: ah, sorry, I thought the other ticket was about swscale; this ticket looks better, I'd close the other instead.

Please do so.

comment:4 by Carl Eugen Hoyos, 10 years ago

Component: undetermineddocumentation
Version: unspecifiedgit-master

comment:5 by a, 10 years ago

Both Issue #3092 and 3093 are reproduceable with the files i uploaded with the ticket

From the comment "Those filtering examples are broken because of the half switch to the new frame counting API.", seems like these examples are not working for some cases i was wondering is this issue going to be fixed in the next release?

Is there a version of ffmpeg which does not have this issue, which i can use?

comment:6 by Clément Bœsch, 10 years ago

The problem is not with the version of FFmpeg but the code of the example which is plain wrong. The idea is that it's mixing both "old" and new reference counted frame API.

See this patch: http://ffmpeg.org/pipermail/ffmpeg-devel/2013-September/147881.html

It provides a (hopefully) working decoding example, and shows how to use both APIs. You can try to look at that code instead until we fix properly our examples.

comment:7 by a, 10 years ago

In the link below

http://ffmpeg.org/pipermail/ffmpeg-devel/2013-September/147881.html

I see reference to 2 different files in examples, [doc/examples/decoding.c, decoding_video.c], but in the actual example path of ffmpeg, I do not see any of these files, I see a file "doc/examples/decoding_encoding.c" instead, is this the file Clément is refering?

comment:8 by Clément Bœsch, 10 years ago

No, that patch was not pushed (yet); maybe I should push it. Just look at the diff.

comment:9 by a, 10 years ago

I will look into the diff

When do you think you, you will have the fix in filtering_video example code?

comment:10 by a, 10 years ago

I merged the changes and it seems to fix the memory crash issue.

Thanks

in reply to:  9 comment:11 by Clément Bœsch, 10 years ago

Replying to ahsan:

I will look into the diff

You can now look at http://git.videolan.org/?p=ffmpeg.git;a=blob;f=doc/examples/demuxing_decoding.c;hb=HEAD

The filtering examples will be fixed later, hopefully soon.

comment:12 by a, 10 years ago

Hi Ubitux,

I am trying to merge, demux and mux example codes so that i can take in any .mp4/.avi/mpg files and then re-encode them in the same format

I am having following issues

  1. MUX example code uses avformat_alloc_output_context2() to create the output context for example for .mpg it will choose MPEG1 encoder, the .mpg file i used is encoded using MPEG2 encoder. I was wondering how can i select different encoders, is there any API call which i can use to re-set the encoder name in the context encoder fails
  1. I uses the fmt_ctx from decoder to set the encoder parameters, i try to memcpy the context (decoder to encoder for the codec) but it fails by setting the different parameters from fmt_ctx to the c c->width = fmt_ctx->streams[video_stream_idx]->codec->width; c->height = fmt_ctx->streams[video_stream_idx]->codec->height; c->coded_width = fmt_ctx->streams[video_stream_idx]->codec->coded_width; ........................ c->gop_size = fmt_ctx->streams[video_stream_idx]->codec->gop_size;

/* emit one intra frame every twelve frames at most */

c->bit_rate = (fmt_ctx->streams[video_stream_idx]->codec->bit_rate == 0) ? 400000 :

fmt_ctx->streams[video_stream_idx]->codec->bit_rate;
/* i am seting it to 400kbps in case it is set to 0 as i am seeing it

for some stream */

........................

I am seeing different issue

  1. GOP Size fmt_ctx most of the time has gop_size = 12 which does not seems like the case for the stream


  1. bit-rate i am getting in the output .mp4 is way higher then the one i see from the fmt_ctx, it seems like encoded bit-stream is in 50Mbits/sec where as input .mp4 was 300kbps or 400kbps bit-rate

I am wondering what is the best way to set the encoder context using the input bitstream
[.mp4, .avi, .mpg etc] files

Regards
Ahsan

comment:13 by Clément Bœsch, 10 years ago

Summary: exception at 0x52B832F8 (avutil-52.dll) in filtering_video.exe: 0xC0000005: Access violation reading location 0xFEEEFEF2.filtering examples are broken

Filtering video should be fixed in 1f7b7d54471711b89f8a64bef1c6636b6aa08c12.

Filtering audio still needs to some adjustments.

Last edited 10 years ago by Clément Bœsch (previous) (diff)

in reply to:  13 comment:14 by Stefano Sabatini, 10 years ago

Analyzed by developer: set
Reproduced by developer: set
Resolution: fixed
Status: reopenedclosed

Replying to ubitux:

Filtering video should be fixed in 1f7b7d54471711b89f8a64bef1c6636b6aa08c12.

Filtering audio still needs to some adjustments.

Should be fixed in latest git.

Note: See TracTickets for help on using tickets.