Quantcast

When and how to use yadif?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

When and how to use yadif?

Yan Seiner
I am capturing a raw video stream.  It is interlaced.  I am trying to
generate stills from the stream, but they all look interlaced....  When
and where in the command line should I use yadif?

ffmpeg -f video4linux2 -s $SIZE -i /dev/video0 -vframes $NFRAMES -f
rawvideo /tmp/video.raw
ffmpeg -f rawvideo -pix_fmt yuyv422 -s $SIZE -i /tmp/video.raw -f image2
-pix_fmt rgb24 /tmp/road%02d.png

Here's a couple of examples of the interlacing I'm seeing:

http://seiner.com/cz/rtpictures/2012_11_24T14h00m12sZ_1.006541_44.387665_-121.666485.jpg
http://seiner.com/cz/rtpictures/2012_11_24T15h02m33sZ_0.963119_44.121713_-122.412587.jpg

I've tried various attemps at it but the documentation gives little help on how to use yadif properly.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: When and how to use yadif?

Carl Eugen Hoyos
Yan Seiner <yan <at> seiner.com> writes:

> I've tried various attemps at it but the documentation
> gives little help on how to use yadif properly.

Could you explain what you tried / share the command lines
together with complete, uncut console output?
That would allow us to possibly improve the documentation.

Thank you, Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: When and how to use yadif?

Yan Seiner
Carl Eugen Hoyos wrote:

> Yan Seiner <yan <at> seiner.com> writes:
>
>  
>> I've tried various attemps at it but the documentation
>> gives little help on how to use yadif properly.
>>    
>
> Could you explain what you tried / share the command lines
> together with complete, uncut console output?
> That would allow us to possibly improve the documentation.
>  
Hi Carl:

I've tried various combinations of yadif=X,Y,Z and moving the -vf yadif
around on the command line.

The problem is that I am doing this by trial and error, and that's not a
very good way to do it.

I can provide more information but I'd like some guidance.  Where in the
line below should the video filters be?  Does it matter?  I get slightly
different output depending on where I insert the filter.  Once I know
where to insert it, I can then try different combinations of yadif
options.  It's also possible that the interlacing is an artifact of the
speed; at a relative speed of 120 MPH (the two cars passing each other)
that's 180 feet per second, or about 3 feet between frames at 60 FPS, so
there may in fact be no way to remove the striping I see short of
getting a progressive camera or using just one field and throwing away
half the horizontal resolution.

Here's a few sample runs:
root@anchor:/tmp# ffmpeg -f rawvideo -pix_fmt yuyv422 -s 512x384 -i
/tmp/videox.raw -f image2 -pix_fmt rgb24 /tmp/test%02d.png
ffmpeg version 0.11.2 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 19 2012 09:50:17 with gcc 4.6.3 20120201 (prerelease)
  configuration: --enable-cross-compile
--cross-prefix=mips-openwrt-linux-uclibc- --arch=mips --target-os=linux
--prefix=/usr --enable-shared --enable-static --disable-debug
--pkg-config=pkg-config --enable-gpl --enable-version3 --disable-asm
--disable-doc --disable-dxva2 --enable-pthreads --disable-optimizations
--enable-small --disable-stripping --enable-zlib --disable-outdevs
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rawvideo @ 0xac6620] Estimating duration from bitrate, this may be
inaccurate
Input #0, rawvideo, from '/tmp/videox.raw':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 512x384,
25 tbr, 25 tbn, 25 tbc
[buffer @ 0xac6d70] w:512 h:384 pixfmt:yuyv422 tb:1/25 sar:0/1
sws_param:flags=2
[buffersink @ 0xac37a0] No opaque field provided
[format @ 0xac3980] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'src' and the filter 'format'
[scale @ 0xac41c0] w:512 h:384 fmt:yuyv422 sar:0/1 -> w:512 h:384
fmt:rgb24 sar:0/1 flags:0x4
Output #0, image2, to '/tmp/test%02d.png':
  Metadata:
    encoder         : Lavf54.6.100
    Stream #0:0: Video: png, rgb24, 512x384, q=2-31, 200 kb/s, 90k tbn,
25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> png)
Press [q] to stop, [?] for help
Truncating packet of size 393216 to 1 0kB time=00:00:00.44 bitrate=  
0.0kbits/s  
frame=   12 fps=5.1 q=0.0 Lsize=       0kB time=00:00:00.48 bitrate=  
0.0kbits/s  
video:18kB audio:0kB global headers:0kB muxing overhead -100.000000%

=================================================

root@anchor:/tmp# ffmpeg -f rawvideo -vf yadif -pix_fmt yuyv422 -s
512x384 -i /tmp/videox.raw -f image2 -pix_fmt rgb24 /tmp/test%02d.png
ffmpeg version 0.11.2 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 19 2012 09:50:17 with gcc 4.6.3 20120201 (prerelease)
  configuration: --enable-cross-compile
--cross-prefix=mips-openwrt-linux-uclibc- --arch=mips --target-os=linux
--prefix=/usr --enable-shared --enable-static --disable-debug
--pkg-config=pkg-config --enable-gpl --enable-version3 --disable-asm
--disable-doc --disable-dxva2 --enable-pthreads --disable-optimizations
--enable-small --disable-stripping --enable-zlib --disable-outdevs
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rawvideo @ 0x516690] Estimating duration from bitrate, this may be
inaccurate
Input #0, rawvideo, from '/tmp/videox.raw':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 512x384,
25 tbr, 25 tbn, 25 tbc
[buffer @ 0x516e30] w:512 h:384 pixfmt:yuyv422 tb:1/25 sar:0/1
sws_param:flags=2
[buffersink @ 0x5137a0] No opaque field provided
[format @ 0x513980] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'src' and the filter 'format'
[scale @ 0x514200] w:512 h:384 fmt:yuyv422 sar:0/1 -> w:512 h:384
fmt:rgb24 sar:0/1 flags:0x4
Output #0, image2, to '/tmp/test%02d.png':
  Metadata:
    encoder         : Lavf54.6.100
    Stream #0:0: Video: png, rgb24, 512x384, q=2-31, 200 kb/s, 90k tbn,
25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> png)
Press [q] to stop, [?] for help
Truncating packet of size 393216 to 1 0kB time=00:00:00.40 bitrate=  
0.0kbits/s  
frame=   12 fps=5.2 q=0.0 Lsize=       0kB time=00:00:00.48 bitrate=  
0.0kbits/s  
video:18kB audio:0kB global headers:0kB muxing overhead -100.000000%

=============================================

root@anchor:/tmp# ffmpeg -f rawvideo -pix_fmt yuyv422 -s 512x384 -vf
yadif -i /tmp/videox.raw -f image2 -pix_fmt rgb24 /tmp/test%02d.png
ffmpeg version 0.11.2 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 19 2012 09:50:17 with gcc 4.6.3 20120201 (prerelease)
  configuration: --enable-cross-compile
--cross-prefix=mips-openwrt-linux-uclibc- --arch=mips --target-os=linux
--prefix=/usr --enable-shared --enable-static --disable-debug
--pkg-config=pkg-config --enable-gpl --enable-version3 --disable-asm
--disable-doc --disable-dxva2 --enable-pthreads --disable-optimizations
--enable-small --disable-stripping --enable-zlib --disable-outdevs
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rawvideo @ 0xb54690] Estimating duration from bitrate, this may be
inaccurate
Input #0, rawvideo, from '/tmp/videox.raw':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 512x384,
25 tbr, 25 tbn, 25 tbc
[buffer @ 0xb54e30] w:512 h:384 pixfmt:yuyv422 tb:1/25 sar:0/1
sws_param:flags=2
[buffersink @ 0xb517a0] No opaque field provided
[format @ 0xb51980] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'src' and the filter 'format'
[scale @ 0xb52200] w:512 h:384 fmt:yuyv422 sar:0/1 -> w:512 h:384
fmt:rgb24 sar:0/1 flags:0x4
Output #0, image2, to '/tmp/test%02d.png':
  Metadata:
    encoder         : Lavf54.6.100
    Stream #0:0: Video: png, rgb24, 512x384, q=2-31, 200 kb/s, 90k tbn,
25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> png)
Press [q] to stop, [?] for help
Truncating packet of size 393216 to 1 0kB time=00:00:00.44 bitrate=  
0.0kbits/s  
frame=   12 fps=2.9 q=0.0 Lsize=       0kB time=00:00:00.48 bitrate=  
0.0kbits/s  
video:18kB audio:0kB global headers:0kB muxing overhead -100.000000%

=================================================

root@anchor:/tmp# ffmpeg -f rawvideo -pix_fmt yuyv422 -s 512x384 -i
/tmp/videox.raw -vf yadif -f image2 -pix_fmt rgb24 /tmp/test%02d.png
ffmpeg version 0.11.2 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 19 2012 09:50:17 with gcc 4.6.3 20120201 (prerelease)
  configuration: --enable-cross-compile
--cross-prefix=mips-openwrt-linux-uclibc- --arch=mips --target-os=linux
--prefix=/usr --enable-shared --enable-static --disable-debug
--pkg-config=pkg-config --enable-gpl --enable-version3 --disable-asm
--disable-doc --disable-dxva2 --enable-pthreads --disable-optimizations
--enable-small --disable-stripping --enable-zlib --disable-outdevs
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rawvideo @ 0x5f8620] Estimating duration from bitrate, this may be
inaccurate
Input #0, rawvideo, from '/tmp/videox.raw':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 512x384,
25 tbr, 25 tbn, 25 tbc
[buffer @ 0x5f8dc0] w:512 h:384 pixfmt:yuyv422 tb:1/25 sar:0/1
sws_param:flags=2
[buffersink @ 0x5f57a0] No opaque field provided
[yadif @ 0x5f6200] mode:0 parity:-1 auto_enable:0
[format @ 0x5f59c0] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'Parsed_yadif_0' and the filter 'format'
[yadif @ 0x5f6200] auto-inserting filter 'auto-inserted scaler 1'
between the filter 'src' and the filter 'Parsed_yadif_0'
[scale @ 0x5f6e00] w:512 h:384 fmt:yuyv422 sar:0/1 -> w:512 h:384
fmt:yuv422p sar:0/1 flags:0x4
[swscaler @ 0x61db30] No accelerated colorspace conversion found from
yuv422p to rgb24.
[swscaler @ 0x6235a0] No accelerated colorspace conversion found from
yuv422p to rgb24.
[swscaler @ 0x629010] No accelerated colorspace conversion found from
yuv422p to rgb24.
[scale @ 0x5f61a0] w:512 h:384 fmt:yuv422p sar:0/1 -> w:512 h:384
fmt:rgb24 sar:0/1 flags:0x4
Output #0, image2, to '/tmp/test%02d.png':
  Metadata:
    encoder         : Lavf54.6.100
    Stream #0:0: Video: png, rgb24, 512x384, q=2-31, 200 kb/s, 90k tbn,
25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> png)
Press [q] to stop, [?] for help
Truncating packet of size 393216 to 1 0kB time=00:00:00.40 bitrate=  
0.0kbits/s  
frame=   12 fps=3.1 q=0.0 Lsize=       0kB time=00:00:00.48 bitrate=  
0.0kbits/s  
video:18kB audio:0kB global headers:0kB muxing overhead -100.000000%

=============================================

root@anchor:/tmp# ffmpeg -f rawvideo -pix_fmt yuyv422 -s 512x384 -i
/tmp/videox.raw -f image2 -pix_fmt rgb24 -vf yadif /tmp/test%02d.png
ffmpeg version 0.11.2 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 19 2012 09:50:17 with gcc 4.6.3 20120201 (prerelease)
  configuration: --enable-cross-compile
--cross-prefix=mips-openwrt-linux-uclibc- --arch=mips --target-os=linux
--prefix=/usr --enable-shared --enable-static --disable-debug
--pkg-config=pkg-config --enable-gpl --enable-version3 --disable-asm
--disable-doc --disable-dxva2 --enable-pthreads --disable-optimizations
--enable-small --disable-stripping --enable-zlib --disable-outdevs
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rawvideo @ 0x5a2620] Estimating duration from bitrate, this may be
inaccurate
Input #0, rawvideo, from '/tmp/videox.raw':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 512x384,
25 tbr, 25 tbn, 25 tbc
[buffer @ 0x5a2d70] w:512 h:384 pixfmt:yuyv422 tb:1/25 sar:0/1
sws_param:flags=2
[buffersink @ 0x5a20c0] No opaque field provided
[yadif @ 0x59a750] mode:0 parity:-1 auto_enable:0
[format @ 0x5a22a0] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'Parsed_yadif_0' and the filter 'format'
[yadif @ 0x59a750] auto-inserting filter 'auto-inserted scaler 1'
between the filter 'src' and the filter 'Parsed_yadif_0'
[scale @ 0x59b000] w:512 h:384 fmt:yuyv422 sar:0/1 -> w:512 h:384
fmt:yuv422p sar:0/1 flags:0x4
[swscaler @ 0x5c7b30] No accelerated colorspace conversion found from
yuv422p to rgb24.
[swscaler @ 0x5cd5a0] No accelerated colorspace conversion found from
yuv422p to rgb24.
[swscaler @ 0x5d3010] No accelerated colorspace conversion found from
yuv422p to rgb24.
[scale @ 0x5a2380] w:512 h:384 fmt:yuv422p sar:0/1 -> w:512 h:384
fmt:rgb24 sar:0/1 flags:0x4
Output #0, image2, to '/tmp/test%02d.png':
  Metadata:
    encoder         : Lavf54.6.100
    Stream #0:0: Video: png, rgb24, 512x384, q=2-31, 200 kb/s, 90k tbn,
25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> png)
Press [q] to stop, [?] for help
Truncating packet of size 393216 to 1 0kB time=00:00:00.44 bitrate=  
0.0kbits/s  
frame=   12 fps=4.3 q=0.0 Lsize=       0kB time=00:00:00.48 bitrate=  
0.0kbits/s  
video:18kB audio:0kB global headers:0kB muxing overhead -100.000000%
root@anchor:/tmp#



_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: When and how to use yadif?

Carl Eugen Hoyos
Yan Seiner <yan <at> seiner.com> writes:

> root <at> anchor:/tmp# ffmpeg -f rawvideo -pix_fmt yuyv422 -s 512x384 -i
> /tmp/videox.raw -vf yadif -f image2 -pix_fmt rgb24 /tmp/test%02d.png

> root <at> anchor:/tmp# ffmpeg -f rawvideo -pix_fmt yuyv422 -s 512x384 -i
> /tmp/videox.raw -f image2 -pix_fmt rgb24 -vf yadif /tmp/test%02d.png

These two lines are equivalent and should de-interlace
your video. If they do not work, please provide a short
input sample.

> ffmpeg version 0.11.2

(This is a little old, if you are a user,
latest git head is always recommended but this should
not be related to your problem.)

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: When and how to use yadif?

Yan Seiner

On Sun, November 25, 2012 11:51 am, Carl Eugen Hoyos wrote:

> Yan Seiner <yan <at> seiner.com> writes:
>
>> root <at> anchor:/tmp# ffmpeg -f rawvideo -pix_fmt yuyv422 -s 512x384 -i
>> /tmp/videox.raw -vf yadif -f image2 -pix_fmt rgb24 /tmp/test%02d.png
>
>> root <at> anchor:/tmp# ffmpeg -f rawvideo -pix_fmt yuyv422 -s 512x384 -i
>> /tmp/videox.raw -f image2 -pix_fmt rgb24 -vf yadif /tmp/test%02d.png
>
> These two lines are equivalent and should de-interlace
> your video. If they do not work, please provide a short
> input sample.

That did the trick.

http://seiner.com/cz/rtpictures/2012_11_26T09h52m23sZ_0.242581_44.093015_-123.126853.jpg

I have not had a chance to test it at higher speeds but it looks like the
deinterlacing works.  :-)  Thanks.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Loading...