Opened 12 years ago

Closed 12 years ago

#2396 closed enhancement (fixed)

Make the Blend effect work with yuvj420p pixel format

Reported by: Björn Sonnenschein Owned by:
Priority: wish Component: avfilter
Version: git-master Keywords: blend
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Using the command

ffmpeg -i (input) -y -vcodec libx264 -acodec copy -vb 100000k -vf "split [T1], [T2] blend [out]; [T1] copy [T2]" -r 25 (output)

With an input video in yuvj420p format, and also using

ffmpeg -i (input) -y -vcodec libx264 -acodec copy -vb 100000k -vf "format=yuvj420p, split [T1], [T2] blend [out]; [T1] copy [T2]" -r 25 (output)

will output a video in yuv420p format, so color depth is lost.
For my purposes I have simply added AV_PIX_FMT_YUVJ420P to the query_formats enum in vf_blend.c and it works well.
It would be great if the blend filter would work with yuvjxxxp formats out of the box, too.

Attachments (1)

fix.patch (613 bytes ) - added by Björn Sonnenschein 12 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Carl Eugen Hoyos, 12 years ago

Keywords: blend added

To make this a valid ticket, please provide your failing command line together with complete, uncut console output.

If you already have a fix for your problem, please post the patch to ffmpeg-devel.

comment:2 by gjdfgh, 12 years ago

The yuvj420p format is deprecated. It's redundant to yuv420p with correct color levels set. Wouldn't it be better to make AVFrame aware of color levels? You'd need this for correct vf_scale behavior anyway.

comment:3 by Björn Sonnenschein, 12 years ago

I will attach the diff.

This is the command line output:

sun@shine /media/dd624e38-4f22-471f-b835-5d0958a4fbf0/Tests/101TEST_/Schaerfe $ ffmpeg -i Roh2.avi -y -vcodec libx264 -acodec copy -vb 100000k -vf "split [T1], [T2] blend [out]; [T1] copy [T2]" -r 25 out.avi
ffmpeg version git-2013-03-19-d4982b1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 21 2013 19:18:21 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1)
  configuration: --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libspeex --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-frei0r
  libavutil      52. 19.101 / 52. 19.101
  libavcodec     55.  1.100 / 55.  1.100
  libavformat    55.  0.100 / 55.  0.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 47.104 /  3. 47.104
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[avi @ 0x33fe0a0] non-interleaved AVI
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from 'Roh2.avi':
  Duration: 00:00:05.40, start: 0.000000, bitrate: 22668 kb/s
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuvj420p, 1920x1080, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
[libx264 @ 0x3401ee0] using cpu capabilities: MMX2 SSE2Fast SSEMisalign LZCNT
[libx264 @ 0x3401ee0] profile High, level 5.1
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf55.0.100
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1920x1080, q=-1--1, 100000 kb/s, 25 tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  134 fps=8.9 q=-1.0 Lsize=   61744kB time=00:00:05.36 bitrate=94273.0kbits/s    
video:60719kB audio:1006kB subtitle:0 global headers:0kB muxing overhead 0.030631%
[libx264 @ 0x3401ee0] frame I:1     Avg QP: 0.03  size:594891
[libx264 @ 0x3401ee0] frame P:84    Avg QP: 0.12  size:490377
[libx264 @ 0x3401ee0] frame B:49    Avg QP: 0.36  size:416116
[libx264 @ 0x3401ee0] consecutive B-frames: 28.4% 67.2%  4.5%  0.0%
[libx264 @ 0x3401ee0] mb I  I16..4: 26.7% 17.8% 55.5%
[libx264 @ 0x3401ee0] mb P  I16..4: 12.7% 10.4% 35.8%  P16..4: 15.1% 11.0%  7.7%  0.0%  0.0%    skip: 7.3%
[libx264 @ 0x3401ee0] mb B  I16..4:  3.6%  3.8% 15.4%  B16..8: 34.5% 14.2%  5.9%  direct:12.5%  skip:10.0%  L0:45.2% L1:42.1% BI:12.7%
[libx264 @ 0x3401ee0] final ratefactor: -6.06
[libx264 @ 0x3401ee0] 8x8 transform intra:17.4% inter:33.8%
[libx264 @ 0x3401ee0] coded y,uvDC,uvAC intra: 82.4% 79.3% 72.8% inter: 66.3% 67.2% 64.3%
[libx264 @ 0x3401ee0] i16 v,h,dc,p: 48% 18% 19% 15%
[libx264 @ 0x3401ee0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 16% 26%  5%  8%  5%  3%  3%  3%
[libx264 @ 0x3401ee0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 16% 18%  4% 10%  9%  7%  4%  3%
[libx264 @ 0x3401ee0] i8c dc,h,v,p: 54% 13% 23%  9%
[libx264 @ 0x3401ee0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x3401ee0] ref P L0: 70.7% 12.0% 14.0%  3.3%
[libx264 @ 0x3401ee0] ref B L0: 84.8% 15.2%  0.0%
[libx264 @ 0x3401ee0] ref B L1: 99.2%  0.8%
[libx264 @ 0x3401ee0] kb/s:92800.38

by Björn Sonnenschein, 12 years ago

Attachment: fix.patch added

comment:4 by Carl Eugen Hoyos, 12 years ago

Status: newopen
Version: unspecifiedgit-master

Please post patches to ffmpeg-devel, they receive more attention there.

comment:5 by Carl Eugen Hoyos, 12 years ago

Resolution: fixed
Status: openclosed

Your patch was applied, thank you!

Note: See TracTickets for help on using tickets.