video flips after being copied

For the developers that use FFmpeg in their software.
gavlig
Posts: 10
Joined: Fri Jun 22, 2012 3:27 pm

Re: video flips after being copied

Post by gavlig » Sat Jun 23, 2012 5:39 pm

After reading rogerdpack's post i've found that in libavformat/riff.c::ff_put_bmp_header(it's called from avformat_write_header) there is a line:

Code: Select all

avio_wl32(pb, enc->codec_tag ? enc->height : -enc->height);
which, i suppose, resolves my question.

But making codec_tag something different from 0 doesn't change anything because avformat_write_header checks whether codec_tag corresponds to the codec_id(and it obviously doesn't) and makes it 0 again.

I tried to make AVFormatContext->stream->AVFormatCodecContext->height *= -1 but it causes sigsegv in avformat_write_header...

Maybe i'm changing wrong height?

If changing height will not work, i think another way of solving my problem is filling AVFormatContext->oformat with proper info, but i don't know how to get it because av_guess_format takes filename or format as parameters and "something.avi" doesn't correspond to the real format neither do "raw" format which i tried :)

2ramiro: i do it, but it doesn't help either

Anyways, i think i'm near to the solution of this problem, thank you guys for your support!
Any new ideas or suggestions would be much appreciated!

gavlig
Posts: 10
Joined: Fri Jun 22, 2012 3:27 pm

Re: video flips after being copied

Post by gavlig » Sat Jun 23, 2012 6:36 pm

making codec_tag not 0 doesn't work too. video becomes unreadable for players and vlc says :
"VLC does not support the audio or video format "BGR". Unfortunately there is no way for you to fix this."

Looks loke this way is wrong. I'm stuck. I think there is just some small flag or field in struct that i need to fill right and that's it.

gavlig
Posts: 10
Joined: Fri Jun 22, 2012 3:27 pm

Re: video flips after being copied

Post by gavlig » Sat Jun 23, 2012 6:42 pm

Another question, what do i need to fill the options with in:

Code: Select all

avformat_write_header(AVFormatContext *s, AVDictionary **options)
?

gavlig
Posts: 10
Joined: Fri Jun 22, 2012 3:27 pm

Re: video flips after being copied

Post by gavlig » Mon Jun 25, 2012 12:36 pm

Problem "solved", video flipping is not my fault, it seems to be ffmpeg's bug, here i've found a letter dated 2007 year http://lists.mplayerhq.hu/pipermail/ffm ... 29690.html
so i'm leaving this issue as long as it can be fixed by double processing or transcoding.
Everybody, thanks for your help!

rogerdpack
Posts: 1877
Joined: Fri Aug 05, 2011 9:56 pm

Re: video flips after being copied

Post by rogerdpack » Mon Jun 25, 2012 1:02 pm

If you can get a reproducible test case I'd file a bug on ffmpeg's tracker.

gavlig
Posts: 10
Joined: Fri Jun 22, 2012 3:27 pm

Re: video flips after being copied

Post by gavlig » Mon Jun 25, 2012 1:05 pm

unfortunately, i can't give you the video i used, but, i think, you can reproduce this bug by making ffmpeg -i /path/to/video/with/bgr24 -vcodec copy /out.avi

rogerdpack
Posts: 1877
Joined: Fri Aug 05, 2011 9:56 pm

Re: video flips after being copied

Post by rogerdpack » Mon Jun 25, 2012 1:11 pm

If you can figure out steps to reproduce it, I'd file it on ffmpeg's bug tracker.

Post Reply
'