This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When I... | |
./ffmpeg -i rtmp://localhost/live/abcd -c:v libx264 -c:a aac -preset ultrafast -f rtmp://asdasdad | |
I get a steady 29fps. | |
However when I use my pass-through filter | |
./ffmpeg -i rtmp://localhost/live/abcd -filter_complex "[0:a][0:v]feed[outa][outv]" -map "[outv]" -map "[outa]" -c:v libx264 -c:a aac -preset ultrafast -f rtmp://asdasdjak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int activate(AVFilterContext *ctx) { | |
FeedContext *feed = ctx->priv; | |
int ret, status, nb_samples = 0; | |
if (!feed->abuf && !feed->vbuf) { | |
if (ff_outlink_frame_wanted(feed->ov)) { | |
ret = ff_inlink_consume_frame(feed->iv, &feed->vbuf); | |
if (ret < 0) | |
return ret; | |
else if (ret==0) { | |
ff_inlink_request_frame(feed->iv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int activate(AVFilterContext *ctx) { | |
FeedContext *feed = ctx->priv; | |
int ret, status, nb_samples = 0; | |
if (!feed->abuf && !feed->vbuf && feed->file.open == 1) { | |
// if a file is open use it instead of the inlinks | |
} | |
else if (!feed->abuf && !feed->vbuf && !feed->file.open) { | |
if (ff_outlink_frame_wanted(feed->ov)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./ffmpeg -f lavfi -i testsrc=rate=30 -filter_complex "anullsrc[a];testsrc=rate=30[v]" -map "[v]" -map "[a]" -f flv <rtmp> | |
Results in high FPS. | |
frame= 6789 fps=672 q=10.2 Lsize= 15829kB time=00:03:46.30 bitrate= 573.0kbits/s speed=22.4x | |
Why if I set rate on testsrc? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activate (ctx) { | |
if ff_outlink_frame_wanted(out_v) && !ctx.vframe | |
ctx.vframe = consume(input_v) if null then ff_inlink_request_frame(input_v) | |
if ff_outlink_frame_wanted(out_a) && !ctx.aframe | |
ctx.aframe = consume(input_a) if null then ff_inlink_request_frame(input_a) | |
if (ctx.vframe) | |
ff_filter_frame(out_v) | |
ctx.vframe = NULL | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activate (ctx) { | |
ctx.abuf = consume(input_a) | |
ctx.vbuf = consume(input_v) | |
if (!ctx.abuf) | |
ff_filter_frame(output_a, ctx.abuf) | |
ctx.abuf = null | |
return | |
if (!ctx.vbuf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread 1 "ffmpeg_g" received signal SIGSEGV, Segmentation fault. | |
0x00000000004c560b in ff_filter_activate_default (filter=<optimized out>) at libavfilter/avfilter.c:1278 | |
1278 if (filter->outputs[i]->frame_wanted_out && | |
(gdb) backtrace | |
#0 0x00000000004c560b in ff_filter_activate_default (filter=<optimized out>) at libavfilter/avfilter.c:1278 | |
#1 ff_filter_activate (filter=0x208f980) at libavfilter/avfilter.c:1429 | |
#2 0x00000000004c8dcc in ff_filter_graph_run_once (graph=<optimized out>) at libavfilter/avfiltergraph.c:1454 | |
#3 0x00000000004c94f6 in get_frame_internal (samples=<optimized out>, flags=1, frame=0x0, ctx=0x20afa00) at libavfilter/buffersink.c:110 | |
#4 av_buffersink_get_frame_flags (ctx=0x20afa00, frame=frame@entry=0x0, flags=flags@entry=1) at libavfilter/buffersink.c:121 | |
#5 0x00000000004c8b49 in avfilter_graph_request_oldest (graph=0x20944c0) at libavfilter/avfiltergraph.c:1407 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, | |
char *res, int res_len, int flags) | |
{ | |
InputSwapContext *inputswap = ctx->priv; | |
int ret = AVERROR(ENOSYS); | |
if (!strcmp(cmd, "swap")) { | |
int nb_streams = 1, i; | |
char name[16]; | |
char default_streams[16], *stream_specs, *spec, *cursor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require('node-fetch'); | |
var config = { | |
jokeApi: "http://api.icndb.com/jokes/random/5?limitTo=[nerdy]" | |
} | |
fetch(config.jokeApi) | |
.then(res => res.json()) | |
.then(json => displayJokes(json)); |