Opened 4 years ago

Closed 3 years ago

#2190 closed defect (fixed)

yuv4mpegpipe does not preserve interlaced settings

Reported by: ulatekh Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: yuv4mpeg
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

I first noticed this in ffmpeg 0.10.6 from the Fedora Core 17 yum repos, but I reproduced it with the latest version from git too.

I'm trying to package a raw YUV video file in some sort of container so that kdenlive will accept it. The video is interlaced (miniDV camcorder source). But every attempt to package it produces a file that says it's progressive video!

How to reproduce:

"head -1 clip.yuv" outputs "YUV4MPEG2 W720 H480 F30000:1001 Ib A10:11 C411" -- notice the bottom-field-first interlacing. All the lossless codecs I tried (huffyuv, ffvhuff, ffv1, and even rawvideo) produced progressive output.

"ffmpeg -i clip.yuv -vcodec huffyuv clip.avi" followed by "ffmpeg -i clip.avi -vcodec rawvideo -f yuv4mpegpipe - | head -1" outputs "YUV4MPEG2 W720 H480 F30000:1001 Ip A10:11 C422 XYSCSS=422"

"ffmpeg -i clip.yuv -vcodec ffvhuff clip.avi" followed by "ffmpeg -i clip.avi -vcodec rawvideo -f yuv4mpegpipe - | head -1" outputs "YUV4MPEG2 W720 H480 F30000:1001 Ip A10:11 C422 XYSCSS=422"

"ffmpeg -i clip.yuv -vcodec ffv1 clip.avi" followed by "ffmpeg -i clip.avi -vcodec rawvideo -f yuv4mpegpipe - | head -1" outputs "YUV4MPEG2 W720 H480 F30000:1001 Ip A10:11 C411 XYSCSS=411"

"ffmpeg -i clip.yuv -vcodec rawvideo clip.avi" followed by "ffmpeg -i clip.avi -vcodec rawvideo -f yuv4mpegpipe - | head -1" outputs "YUV4MPEG2 W720 H480 F30000:1001 Ip A10:11 C411 XYSCSS=411"

Here's the header from ffmpeg when it's run:

ffmpeg version 1.1.git Copyright (c) 2000-2013 the FFmpeg developers

built on Jan 25 2013 19:23:47 with gcc 4.7.2 (GCC) 20120921 (Red Hat 4.7.2-2)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=athlon --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=athlon -fasynchronous-unwind-tables' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib --cpu=athlon --enable-runtime-cpudetect
libavutil 52. 16.100 / 52. 16.100
libavcodec 54. 91.100 / 54. 91.100
libavformat 54. 61.104 / 54. 61.104
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 33.101 / 3. 33.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

Attachments (1)

ticket2190-clip.tar.bz2 (441.8 KB) - added by ulatekh 4 years ago.
A bzip2'd tar archive containing a video clip that reproduces the problem

Download all attachments as: .zip

Change History (15)

Changed 4 years ago by ulatekh

A bzip2'd tar archive containing a video clip that reproduces the problem

comment:1 Changed 4 years ago by cehoyos

  • Component changed from avcodec to avformat
  • Keywords yuv4mpeg added
  • Reproduced by developer set
  • Status changed from new to open
  • Summary changed from Lossless codecs don't preserve interlacing to yuv4mpegpipe does not preserve interlaced settings

For future tickets: Please always provide complete, uncut console output together with your command line!

One of the problems is that the interlacing information cannot even be saved when storing the original stream in yuv4mpeg:

$ ffmpeg -i clip.yuv -f yuv4mpegpipe -|head -1
ffmpeg version N-49300-gcfc7b9c Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 26 2013 03:53:20 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 16.100 / 52. 16.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 33.101 /  3. 33.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[yuv4mpegpipe @ 0x32e9f40] Estimating duration from bitrate, this may be inaccurate
Input #0, yuv4mpegpipe, from 'clip.yuv':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: rawvideo (Y41B / 0x42313459), yuv411p, 720x480, SAR 10:11 DAR 15:11, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
[yuv4mpegpipe @ 0x32f0f00] Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.
Output #0, yuv4mpegpipe, to 'pipe:':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Video: rawvideo (Y41B / 0x42313459), yuv411p, 720x480 [SAR 10:11 DAR 15:11], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> rawvideo)
Press [q] to stop, [?] for help
[yuv4mpegpipe @ 0x32f0f00] Encoder did not produce proper pts, making some up.
YUV4MPEG2 W720 H480 F30000:1001 Ip A10:11 C411 XYSCSS=411
$ ffmpeg -i clip.yuv -vcodec copy -f yuv4mpegpipe -|head -1
ffmpeg version N-49300-gcfc7b9c Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 26 2013 03:53:20 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 16.100 / 52. 16.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 33.101 /  3. 33.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[yuv4mpegpipe @ 0x2a6cf80] Estimating duration from bitrate, this may be inaccurate
Input #0, yuv4mpegpipe, from 'clip.yuv':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: rawvideo (Y41B / 0x42313459), yuv411p, 720x480, SAR 10:11 DAR 15:11, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
[yuv4mpegpipe @ 0x2a73f40] Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.
Output #0, yuv4mpegpipe, to 'pipe:':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Video: rawvideo (Y41B / 0x42313459), yuv411p, 720x480 [SAR 10:11 DAR 15:11], q=2-31, 29.97 fps, 90k tbn, 29.97 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
YUV4MPEG2 W720 H480 F30000:1001 Ip A10:11 C411 XYSCSS=411

I sent a patch that fixes the problem here, but please note that yuv4mpeg is a container (and rawvideo the only codec it supports), the interlacing information that is stored in yuv4mpeg should be stored in the container you use to store the chosen codec, avi cannot store this information afaict, mov does. (Huffyuv might be theoretically able to store the information, but I was unable to find original source code or specification that would explain the exact meaning of the extradata, and even if we found it, it would not be supported by the original codec because it was added later in an experimental version.)
http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/158164

comment:2 Changed 4 years ago by ulatekh

Thank you for looking into this!

I applied your patch, and seem to be having different problems now.

Here's the result of "ffmpeg -i clip.yuv -vcodec copy clip.mov":

ffmpeg version 1.1.git Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 26 2013 09:02:24 with gcc 4.7.2 (GCC) 20120921 (Red Hat 4.7.2-2)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=athlon --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=athlon -fasynchronous-unwind-tables' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib --cpu=athlon --enable-runtime-cpudetect
  libavutil      52. 16.100 / 52. 16.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 33.101 /  3. 33.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[yuv4mpegpipe @ 0x847e560] Estimating duration from bitrate, this may be inaccurate
Input #0, yuv4mpegpipe, from 'clip.yuv':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: rawvideo (Y41B / 0x42313459), yuv411p, 720x480, SAR 10:11 DAR 15:11, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
Output #0, mov, to 'clip.mov':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Video: rawvideo (raw  / 0x20776172), yuv411p, 720x480 [SAR 10:11 DAR 15:11], q=2-31, 29.97 fps, 30k tbn, 29.97 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=    3 fps=0.0 q=-1.0 Lsize=    1520kB time=00:00:00.10 bitrate=124357.7kbits/s    
video:1519kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.053112%

It seems to make a valid archive, but now I can't decode it...here's the output from "ffmpeg -i clip.mov -vcodec rawvideo -f yuv4mpegpipe - | head -1":

ffmpeg version 1.1.git Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 26 2013 09:02:24 with gcc 4.7.2 (GCC) 20120921 (Red Hat 4.7.2-2)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=athlon --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=athlon -fasynchronous-unwind-tables' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib --cpu=athlon --enable-runtime-cpudetect
  libavutil      52. 16.100 / 52. 16.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 33.101 /  3. 33.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'clip.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf54.61.104
  Duration: 00:00:00.10, start: 0.000000, bitrate: 123249 kb/s
    Stream #0:0(eng): Video: rawvideo (raw  / 0x20776172), rgb24, 720x480, 124291 kb/s, SAR 10:11 DAR 15:11, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc
    Metadata:
      handler_name    : DataHandler
[yuv4mpegpipe @ 0x99f44f0] ERROR: yuv4mpeg can only handle yuv444p, yuv422p, yuv420p, yuv411p and gray8 pixel formats. And using 'strict -1' also yuv444p9, yuv422p9, yuv420p9, yuv444p10, yuv422p10, yuv420p10, yuv444p12, yuv422p12, yuv420p12, yuv444p14, yuv422p14, yuv420p14, yuv444p16, yuv422p16, yuv420p16 and gray16 pixel formats. Use -pix_fmt to select one.
Output #0, yuv4mpegpipe, to 'pipe:':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf54.61.104
    Stream #0:0(eng): Video: rawvideo (RGB[24] / 0x18424752), rgb24, 720x480 [SAR 10:11 DAR 15:11], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
    Metadata:
      handler_name    : DataHandler
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> rawvideo)
Could not write header for output file #0 (incorrect codec parameters ?): Input/output error

Since it seems to want a pixel format, I tried "ffmpeg -i clip.mov -vcodec rawvideo -pix_fmt yuv411p -f yuv4mpegpipe - | head -1" and got:

ffmpeg version 1.1.git Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 26 2013 09:02:24 with gcc 4.7.2 (GCC) 20120921 (Red Hat 4.7.2-2)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=athlon --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=athlon -fasynchronous-unwind-tables' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib --cpu=athlon --enable-runtime-cpudetect
  libavutil      52. 16.100 / 52. 16.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 33.101 /  3. 33.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'clip.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf54.61.104
  Duration: 00:00:00.10, start: 0.000000, bitrate: 123249 kb/s
    Stream #0:0(eng): Video: rawvideo (raw  / 0x20776172), rgb24, 720x480, 124291 kb/s, SAR 10:11 DAR 15:11, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc
    Metadata:
      handler_name    : DataHandler
[yuv4mpegpipe @ 0x9bc2640] Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.
Output #0, yuv4mpegpipe, to 'pipe:':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf54.61.104
    Stream #0:0(eng): Video: rawvideo (Y41B / 0x42313459), yuv411p, 720x480 [SAR 10:11 DAR 15:11], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
    Metadata:
      handler_name    : DataHandler
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> rawvideo)
Press [q] to stop, [?] for help
[rawvideo @ 0x9bbad20] Invalid buffer size, packet size 518400 < expected length 1036800
Error while decoding stream #0:0: Invalid argument
[rawvideo @ 0x9bbad20] Invalid buffer size, packet size 518400 < expected length 1036800
Error while decoding stream #0:0: Invalid argument
[rawvideo @ 0x9bbad20] Invalid buffer size, packet size 518400 < expected length 1036800
Error while decoding stream #0:0: Invalid argument
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A    
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead -nan%
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

kdenlive can read the .mov file, but the picture is all white, and it still thinks it's progressive.

If I do the same thing, but with "-vcodec huffyuv" instead of "-vcodec copy", I can decode it without a "pix_fmt" argument, but it still comes out progressive.

Thank you once again for looking into this!

comment:3 Changed 4 years ago by cehoyos

You cannot put arbitrary rawvideo data into mov, this is not defined by the mov specification.

comment:4 Changed 4 years ago by cehoyos

The following works as expected though with my patch:
$ ffmpeg -i clip.yuv -vcodec rawvideo -pix_fmt rgb24 out.mov
$ ffmpeg -i out.mov -pix_fmt yuv422p -f yuv4mpegpipe - |head -1
...
YUV4MPEG2 W720 H480 F30000:1001 Ib A10:11 C422 XYSCSS=422

comment:5 Changed 4 years ago by ulatekh

Your command lines work for me too. Thanks!
Perhaps ffmpeg should error out if one tries to put unsupported types of raw video into a .mov container.

Now, to backport this to 0.10.6! Your changes integrated in just fine, but I can't seem to find a pixel format that'll work with a .mov container and the rawvideo codec. I just get "[mov @ 0x96b1530] Tag RGB[24]/0x18424752 incompatible with output codec id '14'", as in:

ffmpeg version 0.10.6 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 26 2013 08:47:56 with gcc 4.7.2 20120921 (Red Hat 4.7.2-2)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=athlon --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=athlon -fasynchronous-unwind-tables' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib --cpu=athlon --enable-runtime-cpudetect
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
[yuv4mpegpipe @ 0x879f110] Estimating duration from bitrate, this may be inaccurate
Input #0, yuv4mpegpipe, from 'clip.yuv':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: rawvideo (Y41B / 0x42313459), yuv411p, 720x480, SAR 10:11 DAR 15:11, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
[buffer @ 0x87a50a0] w:720 h:480 pixfmt:yuv411p tb:1/1000000 sar:10/11 sws_param:
[buffersink @ 0x87a6670] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out'
[scale @ 0x87a6ad0] w:720 h:480 fmt:yuv411p -> w:720 h:480 fmt:rgb24 flags:0x4
[mov @ 0x87a5530] no pixel formats
[mov @ 0x87a5530] Tag RGB[24]/0x18424752 incompatible with output codec id '14'
Output #0, mov, to 'clip.mov':
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 720x480 [SAR 10:11 DAR 15:11], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> rawvideo)
Could not write header for output file #0 (incorrect codec parameters ?)

I tried to patch the source code to print the available pixel formats, like so:

--- ffmpeg-0.10.6/libavformat/utils.c	2012-10-25 14:21:52.000000000 -0700
+++ ffmpeg-0.10.6-sb/libavformat/utils.c	2013-01-26 11:48:06.581453848 -0700
@@ -31,6 +31,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/dict.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/pixfmt.h"
 #include "metadata.h"
 #include "id3v2.h"
 #include "libavutil/avassert.h"
@@ -3165,6 +3166,18 @@
                     av_get_bits_per_sample(st->codec->codec_id) >> 3;
             break;
         case AVMEDIA_TYPE_VIDEO:
+		{
+			const enum PixelFormat *pix_fmts = st->codec->codec->pix_fmts;
+			if (!pix_fmts)
+				av_log (s, AV_LOG_WARNING, "no pixel formats\n");
+			else
+			{
+				while ((*pix_fmts) != -1)
+				{
+					av_log (s, AV_LOG_WARNING, "pixel format supported: %s\n", av_get_pix_fmt_name (*pix_fmts));
+					++pix_fmts;
+				}
+			}
             if(st->codec->time_base.num<=0 || st->codec->time_base.den<=0){ //FIXME audio too?
                 av_log(s, AV_LOG_ERROR, "time base not set\n");
                 ret = AVERROR(EINVAL);
@@ -3183,6 +3196,7 @@
                 goto fail;
             }
             break;
+		}
         }
 
         if(s->oformat->codec_tag){

But all I get is "[mov @ 0x87a5530] no pixel formats"; see the dump of the command-output above.

I hope that trying to get this backported to 0.10.6 isn't too much to ask...there are a LOT of dependencies on ffmpeg on my machine, and recompiling all of them to work with latest ffmpeg is going to take F*O*R*E*V*E*R...I hope you can sympathize with that.

comment:6 Changed 4 years ago by ulatekh

Never mind about the backport to 0.10.6 if that's a pain...I was able to make a set of RPMs of the latest git version of ffmpeg that co-exist with the yum repos' version of ffmpeg (using the --progs-suffix and --build-suffix parameters to the configure script), and I was able to build mlt and kdenlive on top of them (with the --avformat-suffix parameter to mlt's configure script), and all is well so far!

comment:7 Changed 4 years ago by ulatekh

I just noticed something in your patch...in the libavformat/yuv4mpeg.c section, you have

inter = st->codec->field_order == AV_FIELD_TT || st->codec->field_order == AV_FIELD_TB ? 't' : 'b';

Shouldn't that be

inter = st->codec->field_order == st->codec->field_order == AV_FIELD_TT ? 't' : 'b';

?

comment:8 Changed 4 years ago by cehoyos

I don't think your suggestion makes much sense (although I admit I don't know the evaluation direction of "==").

comment:9 follow-up: Changed 4 years ago by ulatekh

One more change needed...

inter = st->codec->field_order == AV_FIELD_TT ? 't' : 'b';

The old version would always evaluate to 't' whether st->codec->field_order was AV_FIELD_TT or AV_FIELD_TB.

Version 1, edited 4 years ago by ulatekh (previous) (next) (diff)

comment:10 in reply to: ↑ 9 Changed 4 years ago by cehoyos

Replying to ulatekh:

The old version would always evaluate to 't' whether st->codec->field_order was AV_FIELD_TT or AV_FIELD_TB.

This is the expected behaviour copied from libavcodec/rawdec.c.

Do you think it is not correct? If it is not correct, it should be fixed there.

Carl Eugen

comment:11 Changed 4 years ago by ulatekh

Oh...gulp. I just saw libavcodec/avcodec.h -- it never occurred to me that fields would be encoded in one order and displayed in a different order. Please pardon my learning curve!

comment:12 Changed 4 years ago by cehoyos

On the contrary, thank you for testing! Sorry for suggesting huffyuv (and ffvhuff) in mov, it is not supported (missing extradata).

comment:13 Changed 4 years ago by ulatekh

I've been using this patch for a week and it seems to be fine. I think it should be committed!

comment:14 Changed 3 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

I believe that this problem is not reproducible anymore with current git head.

Note: See TracTickets for help on using tickets.