Opened 12 years ago

Closed 9 years ago

#535 closed enhancement (fixed)

encoding support for jpeg2000 yuv422p

Reported by: dave rice Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: j2k
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Happy to see j2k encoding support for a few pixel formats. I'd love to see support for yuv422p and yuv422p10le. When I take yuv422p content as an input, the j2k encoder auto-selects rgb24 even if I state yuv422p encoding explicitly. Here's an output.

ffmpeg -y -t 1 -i OUT2.mov -vcodec j2k -pix_fmt yuv422p -an -strict experimental testj2k.mov
ffmpeg version N-33260-g2f9d6ff, Copyright (c) 2000-2011 the FFmpeg developers

built on Oct 3 2011 23:51:10 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
configuration: --enable-gpl
libavutil 51. 19. 0 / 51. 19. 0
libavcodec 53. 19. 0 / 53. 19. 0
libavformat 53. 13. 0 / 53. 13. 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

Seems stream 1 codec frame rate differs from container frame rate: 29.97 (30000/1001) -> 29.97 (2997/100)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'OUT2.mov':

Metadata:

major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 05:00:00
encoder : Lavf53.13.0

Duration: 00:00:05.08, start: 0.000000, bitrate: 58142 kb/s

Stream #0:0(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 2 channels, s16, 1536 kb/s
Metadata:

creation_time : 1970-01-01 05:00:00

Stream #0:1(eng): Video: dvvideo (dv5n / 0x6E357664), yuv422p, 720x480 [SAR 8:9 DAR 4:3], 57542 kb/s, SAR 19264:21837 DAR 9632:7279, 29.97 fps, 29.97 tbr, 2997 tbn, 29.97 tbc
Metadata:

creation_time : 2011-10-07 19:55:10

Incompatible pixel format 'yuv422p' for codec 'j2k', auto-selecting format 'rgb24'
[buffer @ 0x100e01b40] w:720 h:480 pixfmt:yuv422p tb:1/1000000 sar:19264/21837 sws_param:
[buffersink @ 0x100e01da0] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out'
[scale @ 0x100e02160] w:720 h:480 fmt:yuv422p -> w:720 h:480 fmt:rgb24 flags:0x4
[swscaler @ 0x10101c800] No accelerated colorspace conversion found from yuv422p to rgb24.
[swscaler @ 0x10102f200] No accelerated colorspace conversion found from yuv422p to rgb24.
[swscaler @ 0x101034a00] No accelerated colorspace conversion found from yuv422p to rgb24.
Output #0, mov, to 'testj2k.mov':

Metadata:

major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 05:00:00
encoder : Lavf53.13.0
Stream #0:0(eng): Video: j2k (mjp2 / 0x32706A6D), rgb24, 720x480 [SAR 19264:21837 DAR 9632:7279], q=2-31, 200 kb/s, 2997 tbn, 29.97 tbc
Metadata:

creation_time : 2011-10-07 19:55:10

Stream mapping:

Stream #0.1 -> #0.0 (dvvideo -> j2k)

Press [q] to stop, ? for help
frame= 30 fps= 5 q=0.0 Lsize= 12002kB time=00:00:01.00 bitrate=98224.4kbits/s
video:12001kB audio:0kB global headers:0kB muxing overhead 0.007958%

Change History (5)

comment:1 by Carl Eugen Hoyos, 12 years ago

Priority: normalwish
Reproduced by developer: set
Status: newopen

Some work has been done, you can uncomment the last lines in libavcodec/j2kenc.c to test and fix bugs.

comment:2 by dave rice, 12 years ago

This wish appears to be closed with the recent libopenjpeg pixfmt support (using -pix_fmt yuv422p -c:v libopenjpeg).

ffmpeg -i Test\ for\ Quicktime\ 608\ CC\ file-1.mov -pix_fmt yuv422p -c:v libopenjpeg outj.mov
ffmpeg version N-32546-g6071e4d, Copyright (c) 2000-2011 the FFmpeg developers
  built on Dec 28 2011 21:57:53 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libopenjpeg --cc=/usr/bin/gcc-4.2 --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libfreetype
  libavutil      51. 33.100 / 51. 33.100
  libavcodec     53. 49.100 / 53. 49.100
  libavformat    53. 29.100 / 53. 29.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 55.100 /  2. 55.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  5.100 /  0.  5.100
  libpostproc    51.  2.100 / 51.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd03281ae00] max_analyze_duration 5000000 reached at 5015510

Seems stream 0 codec frame rate differs from container frame rate: 5994.00 (5994/1) -> 29.97 (2997/100)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Test for Quicktime 608 CC file-1.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2010-11-04 17:28:46
  Duration: 00:00:28.39, start: 0.000000, bitrate: 1603 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360, 1485 kb/s, 29.97 fps, 29.97 tbr, 2997 tbn, 5994 tbc
    Metadata:
      creation_time   : 2010-11-04 17:28:46
      handler_name    : ?Apple Alias Data Handler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 109 kb/s
    Metadata:
      creation_time   : 2010-11-04 17:28:46
      handler_name    : ?Apple Alias Data Handler
    Stream #0:2(eng): Subtitle: none (c608 / 0x38303663)
    Metadata:
      creation_time   : 2010-11-04 17:28:46
      handler_name    : ?Apple Alias Data Handler
[buffer @ 0x7fd032415e80] w:640 h:360 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x7fd032416520] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out'
[scale @ 0x7fd03241a340] w:640 h:360 fmt:yuv420p -> w:640 h:360 fmt:yuv422p flags:0x4
Output #0, mov, to 'outj.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2010-11-04 17:28:46
    encoder         : Lavf53.29.100
    Stream #0:0(eng): Video: j2k (mjp2 / 0x32706A6D), yuv422p, 640x360, q=2-31, 200 kb/s, 2997 tbn, 29.97 tbc
    Metadata:
      creation_time   : 2010-11-04 17:28:46
      handler_name    : ?Apple Alias Data Handler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      creation_time   : 2010-11-04 17:28:46
      handler_name    : ?Apple Alias Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libopenjpeg)
  Stream #0:1 -> #0:1 (aac -> libfaac)
Press [q] to stop, [?] for help
frame=  851 fps=  7 q=0.0 Lsize=   70332kB time=00:00:28.39 bitrate=20290.8kbits/s    
video:69972kB audio:335kB global headers:0kB muxing overhead 0.035172%

comment:3 by Carl Eugen Hoyos, 12 years ago

Afaict, the native j2k encoder is still missing yuv422p support.

comment:4 by dave rice, 12 years ago

Yep j2k is still missing yuv422p support. When I first opened the ticket FFmpeg would auto-select rgb24 when yuv422p was requested. Now it auto-selects yuv444p, which is an improvement. yuv422p support in j2k would be great, as libopenjpeg is quite slow. Thanks.

comment:5 by Carl Eugen Hoyos, 9 years ago

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