<p>It does not produce any output file.</p>

<p>After filtering, <code>display_frame()</code> is called, which simply outputs to the console.</p>

<pre><code>/* Trivial ASCII grayscale display. */
p0 = frame-&gt;data[0];
puts("\033c");
for (y = 0; y &lt; frame-&gt;height; y++) {
    p = p0;
    for (x = 0; x &lt; frame-&gt;width; x++)
        putchar(" .-+#"[*(p++) / 52]);
    putchar('\n');
    p0 += frame-&gt;linesize[0];
}
fflush(stdout);
</code></pre>

CC BY-SA 4.0
2019-07-10T16:00:27.700Z
yeah I saw characters. How can I display it visually? e.g. passing to ffplay, storing as a file, etc?
angel_30
CC BY-SA 4.0
2019-07-10T16:21:46.903Z
+ does the code work if I simply pass any filter description?
angel_30
CC BY-SA 4.0
2019-07-10T16:21:47.063Z
See the transcoding example
Gyan
CC BY-SA 4.0
2019-07-10T21:50:04.217Z
I changed the description to `freezedetect=n=-60dB:d=8`. But this filter produces metadata, not frames (like `lavfi.freezedetect.freeze_start: 10.01`). How can I show these data instead?
angel_30
CC BY-SA 4.0
2019-07-10T05:39:02.930Z
2019-07-10T05:39:02.930Z
Gyan
<p>I was trying to compile an FFmpeg example code <a href="https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/filtering_video.c" rel="nofollow noreferrer">HERE</a> that illustrates how to use filters using it's C APIs.</p>

<p>I compiled the code (throuh a universal <code>make</code>). As the usage suggests, I'm doing this:</p>

<p><code>./filtering_video test.mp4</code></p>

<p>But it produces some jumble output on the screen. I was expecting it produces an output <code>.mp4</code> file that can be played.</p>

<p>How to run it correctly? </p>

<p>And does it work with <strong>any</strong> given video filter that is passed to FFmpeg through <code>-vf</code>, if I simply change the filter description specified?</p>

<p><code>const char *filter_descr = "scale=78:24,transpose=cclock";</code></p>

<video><ffmpeg><encoding><video-capture><decoding>
Compile FFmpeg example code
angel_30
# Compile FFmpeg example code

(Asked by: username_0 on 2019-07-10)

I was trying to compile an FFmpeg example code [HERE](https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/filtering_video.c) that illustrates how to use filters using it's C APIs.

I compiled the code (throuh a universal `make`). As the usage suggests, I'm doing this:

`./filtering_video test.mp4`

But it produces some jumble output on the screen. I was expecting it produces an output `.mp4` file that can be played.

How to run it correctly?

And does it work with **any** given video filter that is passed to FFmpeg through `-vf`, if I simply change the filter description specified?

`const char *filter_descr = "scale=78:24,transpose=cclock";`

**Tags:** video, ffmpeg, encoding, video-capture, decoding


---

## 1 answers

### Answer by username_1 on 2019-07-10. Score: 1 | Accepted answer

It does not produce any output file.
After filtering, display_frame() is called, which simply outputs to the console.
/* Trivial ASCII grayscale display. */
p0 = frame->data[0];
puts("\033c");
for (y = 0; y < frame->height; y++) {
    p = p0;
    for (x = 0; x < frame->width; x++)
        putchar(" .-+#"[*(p++) / 52]);
    putchar('\n');
    p0 += frame->linesize[0];
}
fflush(stdout);

> **Comments:**
> **username_0**: yeah I saw characters. How can I display it visually? e.g. passing to ffplay, storing as a file, etc?  
> **username_0**: + does the code work if I simply pass any filter description?  
> **username_1**: See the transcoding example  
> **username_0**: I changed the description to `freezedetect=n=-60dB:d=8`. But this filter produces metadata, not frames (like `lavfi.freezedetect.freeze_start: 10.01`). How can I show these data instead?  

---

