Opened 12 years ago

Closed 11 years ago

#1280 closed defect (fixed)

Loss of alpha with yadif filter (bgra->yuv420 conv inserted instead of bgra->yuva444p)

Reported by: ronag Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: alpha
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

M:\_media>ffmpeg -i wipe.mov -vf yadif=1:-1 wipe2.mov
ffmpeg version N-40301-gc1fe2db Copyright (c) 2000-2012 the FFmpeg developers
  built on May  3 2012 11:44:06 with gcc 4.6.3
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass
 --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable
-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope
njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --e
nable-zlib
  libavutil      51. 49.100 / 51. 49.100
  libavcodec     54. 17.101 / 54. 17.101
  libavformat    54.  3.100 / 54.  3.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 72.104 /  2. 72.104
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 11.100 /  0. 11.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'wipe.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2010-10-19 15:24:10
  Duration: 00:00:01.24, start: 0.000000, bitrate: 8185 kb/s
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), bgra, 720x576, 6485 kb/s
, SAR 512:351 DAR 640:351, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
    Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels
, s16, 1536 kb/s
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
[buffer @ 0000000001e7ae70] w:720 h:576 pixfmt:bgra tb:1/1000000 sar:512/351 sws
_param:flags=2
[yadif @ 0000000001e7af30] mode:1 parity:-1 auto_enable:0
[yadif @ 0000000001e7af30] auto-inserting filter 'auto-inserted scale 0' between
 the filter 'src' and the filter 'Parsed_yadif_0'
[scale @ 0000000001e7af90] w:720 h:576 '''fmt:bgra sar:512/351 -> w:720 h:576 fmt:y
uv420p''' sar:512/351 flags:0x4
[libx264 @ 0000000001ec9d20] using SAR=512/351
[libx264 @ 0000000001ec9d20] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShu
ffle SSE4.2 AVX
[libx264 @ 0000000001ec9d20] profile High, level 3.0
[libx264 @ 0000000001ec9d20] 264 - core 120 r2164 da19765 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed
_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pski
p=1 chroma_qp_offset=-2 threads=12 sliced_threads=0 nr=0 decimate=1 interlaced=0
 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 di
rect=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra
_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69
qpstep=4 ip_ratio=1.40 aq=1:1.00
Guessed Channel Layout for  Input Stream #0.1 : stereo
strptime() unavailable on this system, cannot convert the date string.
Output #0, mov, to 'wipe2.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2010-10-19 15:24:10
    encoder         : Lavf54.3.100
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 720x576 [SAR 512
:351 DAR 640:351], q=-1--1, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 128
 kb/s
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
Stream mapping:
  Stream #0:0 -> #0:0 (qtrle -> libx264)
  Stream #0:1 -> #0:1 (pcm_s16be -> libvo_aacenc)

Change History (6)

comment:1 by Carl Eugen Hoyos, 12 years ago

As-is, this ticket is invalid, because libx264 does not support yuva420p, so a conversion to yuva420p would not make sense with the command line you proposed.

Did you try encoding to ffv1, v408 or libopenjpeg?

comment:2 by Carl Eugen Hoyos, 12 years ago

Description: modified (diff)

comment:3 by ronag, 12 years ago

How do I modify the description?

Here are two logs that should be valid and have the problem.


M:\_media>ffmpeg -i wipe.mov -vcodec qtrle -vf yadif=1:-1 wipe2.mov
ffmpeg version N-40301-gc1fe2db Copyright (c) 2000-2012 the FFmpeg developers
  built on May  3 2012 11:44:06 with gcc 4.6.3
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass
 --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable
-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope
njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --e
nable-zlib
  libavutil      51. 49.100 / 51. 49.100
  libavcodec     54. 17.101 / 54. 17.101
  libavformat    54.  3.100 / 54.  3.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 72.104 /  2. 72.104
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 11.100 /  0. 11.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'wipe.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2010-10-19 15:24:10
  Duration: 00:00:01.24, start: 0.000000, bitrate: 8185 kb/s
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), bgra, 720x576, 6485 kb/s
, SAR 512:351 DAR 640:351, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
    Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels
, s16, 1536 kb/s
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
File 'wipe2.mov' already exists. Overwrite ? [y/N] y
w:720 h:576 pixfmt:bgra tb:1/1000000 sar:512/351 sws_param:flags=2
[yadif @ 0000000001e032b0] mode:1 parity:-1 auto_enable:0
[yadif @ 0000000001e032b0] auto-inserting filter 'auto-inserted scale 0' between
 the filter 'src' and the filter 'Parsed_yadif_0'
[scale @ 0000000001e03500] w:720 h:576 fmt:bgra sar:512/351 -> w:720 h:576 fmt:g
ray sar:512/351 flags:0x4
Guessed Channel Layout for  Input Stream #0.1 : stereo
strptime() unavailable on this system, cannot convert the date string.
Output #0, mov, to 'wipe2.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2010-10-19 15:24:10
    encoder         : Lavf54.3.100
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), gray, 720x576 [SAR 512:3
51 DAR 640:351], q=2-31, 200 kb/s, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 128
 kb/s
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
Stream mapping:
  Stream #0:0 -> #0:0 (qtrle -> qtrle)
  Stream #0:1 -> #0:1 (pcm_s16be -> libvo_aacenc)
Press [q] to stop, [?] for help
Input stream #0:1 frame changed from rate:48000 fmt:s16 ch:2 chl:0x0 to rate:480
00 fmt:s16 ch:2 chl:0x3
frame=   32 fps=0.0 q=0.0 Lsize=     736kB time=00:00:01.24 bitrate=4837.0kbits/
s dup=0 drop=28
video:714kB audio:20kB global headers:0kB muxing overhead 0.280581%

M:\_media>ffmpeg -i wipe.mov -vcodec ffv1 -vf yadif=1:-1 wipe2.mov
ffmpeg version N-40301-gc1fe2db Copyright (c) 2000-2012 the FFmpeg developers
  built on May  3 2012 11:44:06 with gcc 4.6.3
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass
 --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable
-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope
njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --e
nable-zlib
  libavutil      51. 49.100 / 51. 49.100
  libavcodec     54. 17.101 / 54. 17.101
  libavformat    54.  3.100 / 54.  3.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 72.104 /  2. 72.104
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 11.100 /  0. 11.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'wipe.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2010-10-19 15:24:10
  Duration: 00:00:01.24, start: 0.000000, bitrate: 8185 kb/s
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), bgra, 720x576, 6485 kb/s
, SAR 512:351 DAR 640:351, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
    Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels
, s16, 1536 kb/s
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
File 'wipe2.mov' already exists. Overwrite ? [y/N] y
w:720 h:576 pixfmt:bgra tb:1/1000000 sar:512/351 sws_param:flags=2
[yadif @ 0000000001e7e790] mode:1 parity:-1 auto_enable:0
[yadif @ 0000000001e7e790] auto-inserting filter 'auto-inserted scale 0' between
 the filter 'src' and the filter 'Parsed_yadif_0'
[scale @ 0000000001e7e9e0] w:720 h:576 fmt:bgra sar:512/351 -> w:720 h:576 fmt:y
uv420p sar:512/351 flags:0x4
Guessed Channel Layout for  Input Stream #0.1 : stereo
[mov @ 0000000001e210d0] Using MS style video codec tag, the file may be unplaya
ble!
strptime() unavailable on this system, cannot convert the date string.
Output #0, mov, to 'wipe2.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2010-10-19 15:24:10
    encoder         : Lavf54.3.100
    Stream #0:0(eng): Video: ffv1, yuv420p, 720x576 [SAR 512:351 DAR 640:351], q
=2-31, 200 kb/s, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 128
 kb/s
    Metadata:
      creation_time   : 2010-10-19 15:24:10
      handler_name    : Apples aliasdatahanterare
Stream mapping:
  Stream #0:0 -> #0:0 (qtrle -> ffv1)
  Stream #0:1 -> #0:1 (pcm_s16be -> libvo_aacenc)
Press [q] to stop, [?] for help
Input stream #0:1 frame changed from rate:48000 fmt:s16 ch:2 chl:0x0 to rate:480
00 fmt:s16 ch:2 chl:0x3
frame=   32 fps=0.0 q=0.0 Lsize=     131kB time=00:00:01.24 bitrate= 861.3kbits/
s dup=0 drop=28
video:109kB audio:20kB global headers:0kB muxing overhead 1.596373%
Last edited 12 years ago by ronag (previous) (diff)

comment:4 by Carl Eugen Hoyos, 12 years ago

Component: undeterminedavfilter
Reproduced by developer: set
Status: newopen
Summary: Loss of alpha with yadif filter (bgra->yuv420 conv inserted instead of bgra->yuva420p)Loss of alpha with yadif filter (bgra->yuv420 conv inserted instead of bgra->yuva444p)
Version: unspecifiedgit-master

I suspect this is also related to ticket #1080 (which is why -vf format=yuva444p,yadif without -pix_fmt is not sufficient).

$ ffmpeg -loop 1 -i out.png -vcodec qtrle -vf yadif=1:-1 -pix_fmt rgba -vframes 1 out.mov
ffmpeg version N-40448-g16b9156 Copyright (c) 2000-2012 the FFmpeg developers
  built on May  7 2012 10:12:51 with gcc 4.3.2
  configuration: --cc=/usr/local/gcc-4.3.2/bin/gcc --enable-gpl --enable-libspeex --enable-libopenjpeg --extra-ldflags=-lm --enable-libmp3lame --enable-libvpx --enable-libxavs --enable-libtheora --enable-libvorbis
  libavutil      51. 49.100 / 51. 49.100
  libavcodec     54. 19.100 / 54. 19.100
  libavformat    54.  4.100 / 54.  4.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 72.104 /  2. 72.104
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 11.100 /  0. 11.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, image2, from 'out.png':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, rgba, 720x576, 25 fps, 25 tbr, 25 tbn, 25 tbc
Incompatible pixel format 'rgba' for codec 'qtrle', auto-selecting format 'argb'
[buffer @ 0x8ff5960] w:720 h:576 pixfmt:rgba tb:1/1000000 sar:0/1 sws_param:flags=2
[yadif @ 0x8fee0e0] mode:1 parity:-1 auto_enable:0
[buffersink @ 0x8fedc60] auto-inserting filter 'auto-inserted scale 0' between the filter 'Parsed_yadif_0' and the filter 'out'
[yadif @ 0x8fee0e0] auto-inserting filter 'auto-inserted scale 1' between the filter 'src' and the filter 'Parsed_yadif_0'
[scale @ 0x8fee000] w:720 h:576 fmt:rgba sar:0/1 -> w:720 h:576 fmt:yuv420p sar:0/1 flags:0x4
[swscaler @ 0x90442e0] No accelerated colorspace conversion found from yuv420p to argb.
[swscaler @ 0x904cd80] No accelerated colorspace conversion found from yuv420p to argb.
[swscaler @ 0x9055820] No accelerated colorspace conversion found from yuv420p to argb.
[scale @ 0x8fee8a0] w:720 h:576 fmt:yuv420p sar:0/1 -> w:720 h:576 fmt:argb sar:0/1 flags:0x4
Output #0, mov, to 'out.mov':
  Metadata:
    encoder         : Lavf54.4.100
    Stream #0:0: Video: qtrle (rle  / 0x20656C72), argb, 720x576, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (png -> qtrle)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=0.0 Lsize=     952kB time=00:00:00.04 bitrate=195027.4kbits/s dup=0 drop=1
video:952kB audio:0kB global headers:0kB muxing overhead 0.073377%

Workaround is to use -vf format=yuva444p,yadif=1:-1 (and -pix_fmt).

comment:5 by Carl Eugen Hoyos, 12 years ago

Keywords: alpha added; lavfi removed

The issue has improved:
$ ffmpeg -i qtrle.mov -vcodec ffv1 -vf yadif out.mov
now correctly chooses yuva444p

$ ffmpeg -i qtrle.mov -vcodec qtrle -vf yadif -pix_fmt rgba out.mov
$ ffmpeg -i qtrle.mov -vcodec qtrle -vf format=yuva444p,yadif out.mov
both preserve the alpha channel

$ ffmpeg -i qtrle.mov -vcodec qtrle -vf yadif out.mov
uses colour space gray instead of rgba for the output file

$ ffmpeg -i qtrle.mov -vcodec qtrle -vf yadif out.mov
ffmpeg version N-44530-g094991e Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 16 2012 19:18:58 with gcc 4.5.3 (GCC)
  configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-gpl --enable-libass
  libavutil      51. 73.100 / 51. 73.100
  libavcodec     54. 56.100 / 54. 56.100
  libavformat    54. 27.101 / 54. 27.101
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 16.104 /  3. 16.104
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'qtrle.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf54.27.101
  Duration: 00:00:17.38, start: 0.000000, bitrate: 5047 kb/s
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), bgra, 320x213, 5046 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc
    Metadata:
      handler_name    : DataHandler
Output #0, mov, to 'out.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf54.27.101
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), gray, 320x213, q=2-31, 200 kb/s, 30k tbn, 29.97 tbc
    Metadata:
      handler_name    : DataHandler
Stream mapping:
  Stream #0:0 -> #0:0 (qtrle -> qtrle)
Press [q] to stop, [?] for help
frame=  521 fps=0.0 q=0.0 Lsize=    3342kB time=00:00:17.38 bitrate=1575.1kbits/s
video:3339kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.088898%

comment:6 by Michael Niedermayer, 11 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.