Opened 8 years ago

Closed 8 years ago

#1808 closed enhancement (invalid)

Auto add yadif/format filter when needed

Reported by: burek Owned by:
Priority: wish Component: undetermined
Version: unspecified Keywords:
Cc: ld Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
A guy on #ffmpeg channel (L) tried to re-encode his media, using:

ffmpeg -i /media/hd/home-videos/raw/test.avi -crf 18 -c:v libx264 -preset veryslow -c:a flac output.mkv
ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 29 2012 11:22:50 with gcc 4.7.1 (GCC) 20120721 (prerelease)
  configuration: --prefix=/usr --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora --enable-libgsm --enable-libspeex --enable-postproc --enable-shared --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libschroedinger --enable-libopenjpeg --enable-librtmp --enable-libpulse --enable-libv4l2 --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-debug --disable-static
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[avi @ 0x1944240] non-interleaved AVI
[avi @ 0x1944240] Could not find codec parameters for stream 0 (Video: none (422P / 0x50323234), 704x464): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from '/media/hd/home-videos/raw/test.avi':
    encoder         : MEncoder SVN-r35014-4.7.1
  Duration: 01:03:09.55, start: 0.000000, bitrate: 158157 kb/s
    Stream #0:0: Video: none (422P / 0x50323234), 704x464, SAR 59392:59389 DAR 8192:5399, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
File 'output.mkv' already exists. Overwrite ? [y/N] Unable to parse option value "-1" as pixel format
Error opening filters!

After the suggestion to add "-filter:v yadif=1,format=yuv420p" everything worked. Here is a log of it:

<L> in other words, is there a good compressed format viable for archival purposes?
<L> good meaning produces high quality with relatively low size
<L> mutt
<L> whoops, that was supposed to be for zsh
<R> L: yes, I would use ffmpeg -i input -c:v libx264 -preset veryslow -c:a flac output.mkv
<R> er, add -crf 18 after the input
<R> that will give you highly compressed (lossy) video and lossless audio
<L> R: darn, i get "Unable to parse option value "-1" as pixel format
<R> your command and all output
<L> R:
<R> is it interlaced?
<L> i believe it is
<L> i didn't not explicitely deinterlace it
<R> you should, hold on a second
<R> ffmpeg -i input -filter:v yadif:1,format=yuv420p -c:v libx264 -crf 18 -c:a flac output.mkv
<R> L: what is the output fps from the command?
<L> 29.97
<L> i get this tho: No such filter: 'yadif:1'
<R> change it to yadif=1
<R> that should double the framerate of the input.
<L> R: getting somewhere now. must figure out how to set ntsc for v4l2 options
<L> ah, -standard
<L> R: damn, that quality is epic.

So, the question. Can it be implemented in such a way that ffmpeg doesn't just say "Could not find codec parameters", but rather to try to deinterlace it or something, because I believe a lot of ordinary users won't be able to figure out to just add "-filter:v yadif=1,format=yuv420p" out of the blue, without any suggestion either from ffmpeg binary or from reading the docs (which they never do) :)

Change History (5)

comment:1 Changed 8 years ago by cehoyos

Please provide the input file test.avi.

comment:2 Changed 8 years ago by ld

The link to test.avi is here.[]

Version 0, edited 8 years ago by ld (next)

comment:3 Changed 8 years ago by cehoyos

  • Cc ld added

Thank you for the sample!
Is the video in the file supposed to be solid red?
Which software produced the video?

comment:4 Changed 8 years ago by ldenman

ld here, something was funny with my account and i couldn't log in.

anyways, the video does not show up as solid red here with mplayer. It flashes black then blue.

The software I used was mencoder and v4l2. I do not have the exact command at the moment, though.

comment:5 Changed 8 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from new to closed

Sorry for not reacting earlier.

I have three comments regarding this issue:
The title asks for automatic insertion of the yadif filter. This would be a highly welcome feature but I don't see how it could be achieved: Most DVB streams I know (these are the streams that would profit most from the feature since in Europe most tv stations still send the live recorded / sport material interlaced) signal "interlaced" no matter if the content is actually interlaced or was originally recorded at 24/25fps (movies) and shows no interlacing artefacts whatsoever.

The original report above claims that an input file could not be read with "ffmpeg -i file" but could be read with "ffmpeg -i file -vf xxx". This is simply impossible / would be a very serious bug (but there is no indication this was the case).

For me it was interesting that a file with a "new", unknown fourcc was provided as input to ffmpeg - we try hard to support strange formats even if they appear broken in some way. But this has limits and files produced with MEncoder by the reporter do not fall into this category imo.
(You can choose any fourcc for any material with both MEncoder and ffmpeg but that does not make the resulting file useful.)
Please note that MEncoder does not support remuxing the raw input from tv:// the way you tried, it does support (very well) reencoding v4l input using lavc or another encoder.

Note: See TracTickets for help on using tickets.