differences between -vf and -filter_complex

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

differences between -vf and -filter_complex

Dave Rice-3
Hi ffmpeg-user,

In some cases I've been using -vf and -filter_complex interchangeability but notice that some behavior is unexpectedly different.

For instance if I use format=yuv422p10le within -vf and within -filter_complex the output is different. Is there something else I should add to the filterchain to get consistent results.

Below is the output of:
ffmpeg -f lavfi -i testsrc2=r=1:d=5             -vf format=yuv422p10le -f framemd5 -
and
ffmpeg -f lavfi -i testsrc2=r=1:d=5 -filter_complex format=yuv422p10le -f framemd5 -

The output framemd5 do not match and there is not minor differences in the pixel values. Is this expected? Any recommendations to get the same result when using format=yuv422p10le in both -vf and -filter_complex? Which output is correct?

ffmpeg -f lavfi -i testsrc2=r=1:d=5 -vf format=yuv422p10le -f framemd5 -
ffmpeg version N-47211-g164e277326 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.38)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-164e277 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtesseract --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 62.100 / 55. 62.100
  libavcodec     57. 95.100 / 57. 95.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 88.100 /  6. 88.100
  libavresample   3.  6.  0 /  3.  6.  0
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[opencl @ 0x10fe94d68] Same kernel code has been registered
    Last message repeated 1 times
Input #0, lavfi, from 'testsrc2=r=1:d=5':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 1 fps, 1 tbr, 1 tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
#format: frame checksums
#version: 2
#hash: MD5
#software: Lavf57.72.101
#tb 0: 1/1
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 320x240
#sar 0: 1/1
#stream#, dts,        pts, duration,     size, hash
Output #0, framemd5, to 'pipe:':
  Metadata:
    encoder         : Lavf57.72.101
    Stream #0:0: Video: rawvideo (Y3[10][10] / 0xA0A3359), yuv422p10le, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 1536 kb/s, 1 fps, 1 tbn, 1 tbc
    Metadata:
      encoder         : Lavc57.95.100 rawvideo
0,          0,          0,        1,   307200, b8ef3d6c4fc96d70fafbf20afd8f9cdf
0,          1,          1,        1,   307200, dada36d572dfe9b75b799b207e54590b
0,          2,          2,        1,   307200, f6b2bd8a2cafbe7261bd97cd41930ad3
0,          3,          3,        1,   307200, 5efbf76a4e8af59271de6a3e8cfb63f4
0,          4,          4,        1,   307200, f2289ce67d1f24230cee1219dc2557a5
frame=    5 fps=0.0 q=-0.0 Lsize=       1kB time=00:00:05.00 bitrate=   1.0kbits/s speed= 754x    
video:1500kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown


ffmpeg -f lavfi -i testsrc2=r=1:d=5 -filter_complex format=yuv422p10le -f framemd5 -
ffmpeg version N-47211-g164e277326 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.38)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-164e277 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtesseract --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 62.100 / 55. 62.100
  libavcodec     57. 95.100 / 57. 95.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 88.100 /  6. 88.100
  libavresample   3.  6.  0 /  3.  6.  0
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[opencl @ 0x1026d6d68] Same kernel code has been registered
    Last message repeated 1 times
Input #0, lavfi, from 'testsrc2=r=1:d=5':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 1 fps, 1 tbr, 1 tbn, 1 tbc
Stream mapping:
  Stream #0:0 (rawvideo) -> format
  format -> Stream #0:0 (rawvideo)
Press [q] to stop, [?] for help
#format: frame checksums
#version: 2
#hash: MD5
#software: Lavf57.72.101
#tb 0: 1/1
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 320x240
#sar 0: 1/1
#stream#, dts,        pts, duration,     size, hash
Output #0, framemd5, to 'pipe:':
  Metadata:
    encoder         : Lavf57.72.101
    Stream #0:0: Video: rawvideo (Y3[10][10] / 0xA0A3359), yuv422p10le, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 1536 kb/s, 1 fps, 1 tbn, 1 tbc
    Metadata:
      encoder         : Lavc57.95.100 rawvideo
0,          0,          0,        1,   307200, e7fa6a19f1f6cc2a146b099cf0f7d9a5
0,          1,          1,        1,   307200, 1191d0f7b6341fa98b1e6e2feac0608a
0,          2,          2,        1,   307200, 5acfb73352874db79a82064515069b79
0,          3,          3,        1,   307200, 73e8573563a04c2d652905dd8a4654a0
0,          4,          4,        1,   307200, ec3a90bdf9325ca721df12edc08d3403
frame=    5 fps=0.0 q=-0.0 Lsize=       1kB time=00:00:05.00 bitrate=   1.0kbits/s speed= 771x    
video:1500kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Best Regards,
Dave Rice
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: differences between -vf and -filter_complex

Gyan
On Wed, May 10, 2017 at 8:17 PM, Dave Rice <[hidden email]> wrote:

>
> For instance if I use format=yuv422p10le within -vf and within
> -filter_complex the output is different. Is there something else I should
> add to the filterchain to get consistent results.
>
> Best Regards,
> Dave Rice
>

Does not affect conversions to RGB formats of any bit depth. Does not
affect conversions if chroma sampling scheme is the same i.e. -f lavfi -i
testsrc2=r=1:d=5,format=yuv422p or yuv422p16le. Also does not affect if
only the luma plane is converted. So this has to do with converting the
chroma sampling frequency in swscale.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: differences between -vf and -filter_complex

Gyan
On Wed, May 10, 2017 at 9:08 PM, Gyan <[hidden email]> wrote:

>
>
> On Wed, May 10, 2017 at 8:17 PM, Dave Rice <[hidden email]> wrote:
>
>>
>> For instance if I use format=yuv422p10le within -vf and within
>> -filter_complex the output is different. Is there something else I should
>> add to the filterchain to get consistent results.
>>
>> Best Regards,
>> Dave Rice
>>
>
> These two commands produce the same result:

ffmpeg -f lavfi -i testsrc2=r=1:d=5 -f lavfi -i testsrc2=r=1:d=5
-filter_complex scale=flags=bicubic,format=yuv422p10le  -f framemd5 -

ffmpeg -f lavfi -i testsrc2=r=1:d=5 -f lavfi -i testsrc2=r=1:d=5 -vf
scale=flags=bicubic,format=yuv422p10le -f framemd5 -


0,          0,          0,        1,   307200,
b8ef3d6c4fc96d70fafbf20afd8f9cdf
0,          1,          1,        1,   307200,
dada36d572dfe9b75b799b207e54590b
0,          2,          2,        1,   307200,
f6b2bd8a2cafbe7261bd97cd41930ad3
0,          3,          3,        1,   307200,
5efbf76a4e8af59271de6a3e8cfb63f4
0,          4,          4,        1,   307200,
f2289ce67d1f24230cee1219dc2557a5
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: differences between -vf and -filter_complex

Dave Rice-3

> On May 10, 2017, at 11:55 AM, Gyan <[hidden email]> wrote:
>
> On Wed, May 10, 2017 at 9:08 PM, Gyan <[hidden email]> wrote:
>
>>
>>
>> On Wed, May 10, 2017 at 8:17 PM, Dave Rice <[hidden email]> wrote:
>>
>>>
>>> For instance if I use format=yuv422p10le within -vf and within
>>> -filter_complex the output is different. Is there something else I should
>>> add to the filterchain to get consistent results.
>>>
>>> Best Regards,
>>> Dave Rice
>>>
>>
>> These two commands produce the same result:
>
> ffmpeg -f lavfi -i testsrc2=r=1:d=5 -f lavfi -i testsrc2=r=1:d=5
> -filter_complex scale=flags=bicubic,format=yuv422p10le  -f framemd5 -
>
> ffmpeg -f lavfi -i testsrc2=r=1:d=5 -f lavfi -i testsrc2=r=1:d=5 -vf
> scale=flags=bicubic,format=yuv422p10le -f framemd5 -
>
>
> 0,          0,          0,        1,   307200,
> b8ef3d6c4fc96d70fafbf20afd8f9cdf
> 0,          1,          1,        1,   307200,
> dada36d572dfe9b75b799b207e54590b
> 0,          2,          2,        1,   307200,
> f6b2bd8a2cafbe7261bd97cd41930ad3
> 0,          3,          3,        1,   307200,
> 5efbf76a4e8af59271de6a3e8cfb63f4
> 0,          4,          4,        1,   307200,
> f2289ce67d1f24230cee1219dc2557a5

Thank you so much. Adding `scale=flags=bicubic` into my workflow produced consistent results. I'm still a bit uncertain why these two routes opt for different defaults, but this method allows them to be forced to the same default. Thanks again.
Dave Rice

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

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: differences between -vf and -filter_complex

Paul B Mahol
In reply to this post by Dave Rice-3
On 5/10/17, Dave Rice <[hidden email]> wrote:

> Hi ffmpeg-user,
>
> In some cases I've been using -vf and -filter_complex interchangeability but
> notice that some behavior is unexpectedly different.
>
> For instance if I use format=yuv422p10le within -vf and within
> -filter_complex the output is different. Is there something else I should
> add to the filterchain to get consistent results.
>
> Below is the output of:
> ffmpeg -f lavfi -i testsrc2=r=1:d=5             -vf format=yuv422p10le -f
> framemd5 -
> and
> ffmpeg -f lavfi -i testsrc2=r=1:d=5 -filter_complex format=yuv422p10le -f
> framemd5 -

Both commands are suboptimal, use:

ffmpeg -f lavfi -i testsrc2=r=1:d=5,format=yuv422p10le -f framemd5 -
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: differences between -vf and -filter_complex

Dave Rice-3

> On May 10, 2017, at 2:13 PM, Paul B Mahol <[hidden email]> wrote:
>
> On 5/10/17, Dave Rice <[hidden email] <mailto:[hidden email]>> wrote:
>> Hi ffmpeg-user,
>>
>> In some cases I've been using -vf and -filter_complex interchangeability but
>> notice that some behavior is unexpectedly different.
>>
>> For instance if I use format=yuv422p10le within -vf and within
>> -filter_complex the output is different. Is there something else I should
>> add to the filterchain to get consistent results.
>>
>> Below is the output of:
>> ffmpeg -f lavfi -i testsrc2=r=1:d=5             -vf format=yuv422p10le -f
>> framemd5 -
>> and
>> ffmpeg -f lavfi -i testsrc2=r=1:d=5 -filter_complex format=yuv422p10le -f
>> framemd5 -
>
> Both commands are suboptimal, use:
>
> ffmpeg -f lavfi -i testsrc2=r=1:d=5,format=yuv422p10le -f framemd5 -

I usually avoid lavfi formatted inputs when I can, because IIUC there's no method to preserve frame interlacement data from the input through the filterchain. See https://trac.ffmpeg.org/ticket/4057.
Dave Rice
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: differences between -vf and -filter_complex

Paul B Mahol
On 5/10/17, Dave Rice <[hidden email]> wrote:

>
>> On May 10, 2017, at 2:13 PM, Paul B Mahol <[hidden email]> wrote:
>>
>> On 5/10/17, Dave Rice <[hidden email] <mailto:[hidden email]>> wrote:
>>> Hi ffmpeg-user,
>>>
>>> In some cases I've been using -vf and -filter_complex interchangeability
>>> but
>>> notice that some behavior is unexpectedly different.
>>>
>>> For instance if I use format=yuv422p10le within -vf and within
>>> -filter_complex the output is different. Is there something else I should
>>> add to the filterchain to get consistent results.
>>>
>>> Below is the output of:
>>> ffmpeg -f lavfi -i testsrc2=r=1:d=5             -vf format=yuv422p10le -f
>>> framemd5 -
>>> and
>>> ffmpeg -f lavfi -i testsrc2=r=1:d=5 -filter_complex format=yuv422p10le -f
>>> framemd5 -
>>
>> Both commands are suboptimal, use:
>>
>> ffmpeg -f lavfi -i testsrc2=r=1:d=5,format=yuv422p10le -f framemd5 -
>
> I usually avoid lavfi formatted inputs when I can, because IIUC there's no
> method to preserve frame interlacement data from the input through the
> filterchain. See https://trac.ffmpeg.org/ticket/4057.

How is that even related? format simply tells in what format testsrc2
will render its output.

By your command it is doing slow scale work internally always.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: differences between -vf and -filter_complex

Nicolas George
In reply to this post by Paul B Mahol
Le primidi 21 floréal, an CCXXV, Paul B Mahol a écrit :
> ffmpeg -f lavfi -i testsrc2=r=1:d=5,format=yuv422p10le -f framemd5 -

This is still suboptimal.

ffmpeg -lavfi testsrc2=r=1:d=5,format=yuv422p10le -f framemd5 -

No need to wrap the frames in packets.

Regards,

--
  Nicolas George

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

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment