I was trying to compile an FFmpeg example code HERE 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";


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];
for (y = 0; y < frame->height; y++) {
    p = p0;
    for (x = 0; x < frame->width; x++)
        putchar(" .-+#"[*(p++) / 52]);
    p0 += frame->linesize[0];
  • yeah I saw characters. How can I display it visually? e.g. passing to ffplay, storing as a file, etc? – Tina J Jul 10 '19 at 16:00
  • + does the code work if I simply pass any filter description? – Tina J Jul 10 '19 at 16:21
  • 1
    See the transcoding example – Gyan Jul 10 '19 at 16:21
  • 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? – Tina J Jul 10 '19 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.