Opened 13 years ago
Closed 13 years ago
#570 closed defect (fixed)
Video flipped with inverted colors in flash after transcode
Reported by: | Bram Avontuur | Owned by: | Michael Niedermayer |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
When transcoding the sample video below, the resulting output file will play OK in ubuntu's video player, but in a flash player it will be flipped and having its colors inverted.
We're currently running an ffmpeg from oct 2010 which does not have this problem. I've tested ffmpeg 0.8.3, 0.8.5 and the master branch from yesterday (libx264 dito) which do exhibit the problem.
After some investigation, it turns out that the corruption only occurs on certain output video sizes, while it works with other sizes.
Command line with output resolution that produces the corrupt output:
./ffmpeg -y -i '/tmp/in.mp4' -s 320x180 -vcodec libx264 -acodec libfaac /tmp/out.mp4
320x184 output size produces a valid video in flash:
./ffmpeg -y -i '/tmp/in.mp4' -s 320x184 -vcodec libx264 -acodec libfaac /tmp/out.mp4
But 320x176 is also corrupted:
./ffmpeg -y -i '/tmp/in.mp4' -s 320x176 -vcodec libx264 -acodec libfaac /tmp/out.mp4
The sample input video is uploaded to upload.ffmpeg.org as /upload/uploaded/flipped_in_flash_after_transcode.mp4 and can also be retrieved here: http://bram.name/flipped_in_flash_after_transcode.mp4
A sample output video with 320x180 dimensions that is corrupt in flash: http://bram.name/output_flipped_in_flash.mp4
You can test the corruption in flash on this jwplayer test page (corrupt output file already filled in): http://developer.longtailvideo.com/trac/testing/?player=v5&skin=&file=http%3A%2F%2Fbram.name%2Foutput_flipped_in_flash.mp4&height=260&width=500
Output for ffmpeg -v 9 -loglevel 99 -i /tmp/in.mp4
:
ffmpeg version N-33733-gfe87b2e, Copyright (c) 2000-2011 the FFmpeg developers built on Oct 17 2011 21:24:52 with gcc 4.3.2 configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libx264 --enable-libvorbis --enable-libtheora --enable-avfilter --prefix=/home/botr/botr/localroot/opt/encoder --extra-cflags='-I /home/botr/botr/localroot/opt/encoder/include' --extra-ldflags='-L /home/botr/botr/localroot/opt/encoder/lib' --arch=x86_32 --enable-runtime-cpudetect --disabl e-ffplay --disable-ffserver --disable-ffprobe --disable-doc --enable-libvpx libavutil 51. 21. 0 / 51. 21. 0 libavcodec 53. 20. 1 / 53. 20. 1 libavformat 53. 16. 0 / 53. 16. 0 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 43. 6 / 2. 43. 6 libswscale 2. 1. 0 / 2. 1. 0 libpostproc 51. 2. 0 / 51. 2. 0 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x96ebaa0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x96ebaa0] ISO: File Type Major Brand: mp42 [aac @ 0x96f2bc0] Unsupported bit depth: 0 [h264 @ 0x96f1f90] no picture [mov,mp4,m4a,3gp,3g2,mj2 @ 0x96ebaa0] All info found rfps: 0.083333 0.000541 rfps: 0.166667 0.002165 rfps: 0.250000 0.004871 rfps: 0.333333 0.008659 rfps: 0.416667 0.013530 rfps: 0.500000 0.019483 rfps: 29.500000 0.017218 Last message repeated 1 times rfps: 29.583333 0.011654 Last message repeated 1 times rfps: 29.666667 0.007172 Last message repeated 1 times rfps: 29.750000 0.003773 Last message repeated 1 times rfps: 29.833333 0.001456 Last message repeated 1 times rfps: 29.916667 0.000222 Last message repeated 1 times rfps: 30.000000 0.000070 rfps: 30.083333 0.001001 rfps: 30.166667 0.003013 rfps: 30.250000 0.006109 rfps: 30.333333 0.010286 rfps: 30.416667 0.015547 rfps: 59.500000 0.015092 Last message repeated 1 times rfps: 59.583333 0.009917 Last message repeated 1 times rfps: 59.666667 0.005825 Last message repeated 1 times rfps: 59.750000 0.002815 Last message repeated 1 times rfps: 59.833333 0.000888 Last message repeated 1 times rfps: 59.916667 0.000043 Last message repeated 1 times rfps: 29.970030 0.000000 Last message repeated 1 times rfps: 59.940060 0.000000 Last message repeated 1 times Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/in.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2008-02-15 20:41:25 Duration: 00:03:11.72, start: 0.000000, bitrate: 181 kb/s Chapter #0.0: start 0.000000, end 191.724854 Metadata: title : Stream #0:0(eng), 30, 1/48000: Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 1001/60000, 1502 kb/s, SAR 9709:8192 DAR 29127:16384, 29.97 fps, 29.97 tbr, 48k tbn, 59.94 tbc Metadata: creation_time : 2008-02-15 20:41:25 Stream #0:1(und), 1, 1/48000: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 104 kb/s Metadata: creation_time : 2008-02-15 20:41:25 Stream #0:2(eng), 0, 1/48000: Subtitle: mov_text (text / 0x74786574) Metadata: creation_time : 2008-02-15 20:41:25
Change History (18)
comment:1 by , 13 years ago
Component: | FFmpeg → undetermined |
---|
comment:2 by , 13 years ago
The intro text of that vid is not mirrored for you in the flash player? I've verified this on osx and linux. It does indeed play fine in QuickTime.
The issue is that it must work in flash, and a previous version of ffmpeg that we run on production does produce videos without the corruption on the exact same input file with the exact same cmd line. So somewhere along the line this must have been introduced.
comment:3 by , 13 years ago
If you believe there is a regression, please find the revision introducing it with git bisect.
comment:4 by , 13 years ago
Afaict, this is a regression in Adobe's Flash Player (it is not reproducible with old versions).
Or can you point to a FFmpeg revision that introduced the problem?
comment:5 by , 13 years ago
I believe this is a regression somewhere in ffmpeg/x264. Using the older ffmpeg I can still produce a non-corrupted video that will work with the latest adobe flash plugin from the same input file and the same cmd.
I will have to spend some time figuring out how to locate the regression as I'm not very experienced in that field.
comment:7 by , 13 years ago
git bisect will show you very fast the version introducing your problem.
comment:8 by , 13 years ago
Found the culprit, it's commit c8868f28e357e7e6ffe3254d0056b3e8033fe8e5
With just this commit I can repeatedly and without fail confirm that the video will show up corrupted in flash.
comment:9 by , 13 years ago
FYI : I am also getting the same behaviour when converting older videos to H.264. The video is flipped.
comment:10 by , 13 years ago
I investigated some more. The commit mentioned above fixes 1 video, but breaks another. I have now found the real culprit, and that is commit e7c7b0d000e81d24327602e04d8fed400dbb7193:
Author: Michael Niedermayer <michaelni@gmx.at> Date: Fri Apr 1 17:30:45 2011 +0200 Another aspect ratio fix try. This leaves the setdar addition at the end (preferred by people). Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Later on, a new commit actually fixes the issue: d1eb50bb29caad9745631759265f475177df99b9
But this commit is 100% reversed in commit d6c858658f2cd5cabbfecc008503c30951256fdd, because "it breaks fate" (?).
So looks like the aspect ratio fix attempt is buggy.
comment:12 by , 13 years ago
Are you suggesting the changes in ffmpeg have nothing to do with it even though they do influence the behavior? I do not have old flash versions to test with.
comment:13 by , 13 years ago
I do have an old flash version installed, and with it, the problem is not reproducible.
comment:14 by , 13 years ago
I have tested with Flash 10.0, 10.1 and 10.3. They all exhibit the same problem. Pretty much everyone with Flash installed has one of these versions. So in practice this would mean that, for affected videos, we'd serve broken videos to all of those until they've upgraded to a version in which Adobe has applied a fix. That will take a pretty long time and is therefore not a practical solution.
It seems very obvious that the behavior can be influenced within ffmpeg itself, and all commits that change the behavior that I mentioned above are related to the aspect ratio. It would therefore be very beneficial if we can trick this down and figure out a fix that will work with the install base of Flash.
comment:16 by , 13 years ago
I have tried exactly that version as well now on a WinXP box and it is corrupted here. Are we looking at the same generated mp4, http://bram.name/output_flipped_in_flash.mp4 ? Or are you using a self-transcoded mp4? If so, does the link above show corruption? Please clarify. In that case there's a difference in our ffmpeg builds somehow.
comment:17 by , 13 years ago
Curious if there has been any progress on this ticket. I've experienced the same issue and have found the problem across Windows, Mac and Linux across a large number of Flash versions.
comment:18 by , 13 years ago
Reproduced by developer: | set |
---|---|
Resolution: | → fixed |
Status: | new → closed |
This is a bug in flash player
Ive added a workaround to ffmpeg, which should be in git master in a few moments
Replying to brama:
Does not look corrupted to me...
For mp4 files, I would suggest QuickTime as reference application, certainly not FlashPlayer.
Do the output files play correctly with current QuickTime player?