<html><head></head><body><div class="ydp23f10b3cyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div></div>
        <div><span style="color: rgb(38, 40, 42); font-size: 13px;">On Thursday, March 31, 2022, 10:39:47 PM GMT+3, Yurii Monakov <monakov.y@gmail.com> wrote:</span><br></div></div><div id="ydpc59a44d0yahoo_quoted_9327748360" class="ydpc59a44d0yahoo_quoted"><div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                <div><br></div>
                <div><br></div>
                <div><div id="ydpc59a44d0yiv5030486213"><div><div>Hi</div><div><br clear="none"></div><div>Sorry for some kind of offtopic on this list, but you should try to create simple gstreamer pipeline. From my opinion, gstreamer has all pipeline elements which you need (tee, decode, encode, whatever) and will be much more simpler to get working than bare ffmpeg libraries. You can test your pipeline with gst-launch utility.</div><div><br clear="none"></div><div>Yurii</div><div><br clear="none"><div class="ydpc59a44d0yiv5030486213gmail_quote"><div dir="ltr" class="ydpc59a44d0yiv5030486213gmail_attr">чт, 31 марта 2022 г. в 10:30, Hillel Rosensweig via Libav-user <<a shape="rect" href="mailto:libav-user@ffmpeg.org" rel="nofollow" target="_blank">libav-user@ffmpeg.org</a>>:<br clear="none"></div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;" class="ydpc59a44d0yiv5030486213gmail_quote"><div id="ydpc59a44d0yiv5030486213yqt51621" class="ydpc59a44d0yiv5030486213yqt7787062198"><div><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div dir="ltr">Hello all, </div><div dir="ltr"><br clear="none"></div><div dir="ltr">I have been trying to output video (from my webcam) simultaneously to both a file ('out.mkv') and pipe: </div><div dir="ltr">The file gets filtered frames packets, and the pipe: gets ufiltered rawvideo.</div><div dir="ltr">My frame rate is 30 fps. However, I am getting a far lower framerate in my file output.</div><div dir="ltr"><br clear="none"></div><div dir="ltr">Attached is the while loop which reads packets and writes them to output:</div><div dir="ltr"><br clear="none"></div><div dir="ltr"><div><div>while (1) {</div><div>    av_read_frame(ifmt_ctx, packet);</div><div>    stream_index = packet->stream_index;</div><div>    </div><div>    StreamContext *stream = &file_stream_ctx[stream_index];</div><div>    </div><div>    av_packet_rescale_ts(packet,</div><div>                         ifmt_ctx->streams[stream_index]->time_base,</div><div>                         stream->dec_ctx->time_base);</div><div>    avcodec_send_packet(stream->dec_ctx, packet);</div><div>    </div><div>    while (ret >= 0) {</div><div>        avcodec_receive_frame(stream->dec_ctx, stream->dec_frame);</div><div>    </div><div>        stream->dec_frame->pts = stream->dec_frame->best_effort_timestamp;</div><div>        ret = filter_encode_write_frame(stream->dec_frame, stream_index, file_stream_ctx,</div><div>                                                file_filter_ctx, file_ofmt_ctx);</div><div>        ret = av_interleaved_write_frame(pipe_ofmt_ctx, packet);</div><div>    }</div><div dir="ltr">}</div></div><div dir="ltr"><br clear="none"></div><div dir="ltr"><div><div dir="ltr">'ifmt_ctx' is the AVFormatContext for the webcam.</div><div dir="ltr">'file_ofmt_ctx', is the AVFormatContext for the pipe for the output file, and pipe_ofmt_ctx is the AVFormatContext.</div><div dir="ltr">'file_stream_ctx' and 'file_filter_ctx' are the stream and filter contexts used for filtering and encoding the file output.</div><div dir="ltr"><br clear="none"></div></div><div dir="ltr"><br clear="none"></div><div dir="ltr">My guess is that writing to the pipe is taking too long and not allowing the next packet to be read on time - causing a lower frame rate. Does that make sense? If so - any suggestions on how to fix it? (I tried using AVFMT_FLAG_NONBLOCK but it doesn't seem to help).</div><div dir="ltr"><br clear="none"></div><div dir="ltr">Thanks</div><div dir="ltr"><br clear="none"></div><div dir="ltr">Hillel</div></div></div></div></div></div>_______________________________________________<br clear="none">
Libav-user mailing list<br clear="none">
<a shape="rect" href="mailto:Libav-user@ffmpeg.org" rel="nofollow" target="_blank">Libav-user@ffmpeg.org</a><br clear="none">
<a shape="rect" href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="nofollow" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br clear="none">
<br clear="none">
To unsubscribe, visit link above, or email<br clear="none">
<a shape="rect" href="mailto:libav-user-request@ffmpeg.org" rel="nofollow" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br clear="none">
</blockquote></div></div>
</div></div><div class="ydpc59a44d0yqt7787062198" id="ydpc59a44d0yqt22355">_______________________________________________<br clear="none">Libav-user mailing list<br clear="none"><a shape="rect" href="mailto:Libav-user@ffmpeg.org" rel="nofollow" target="_blank">Libav-user@ffmpeg.org</a><br clear="none"><a shape="rect" href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="nofollow" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br clear="none"><br clear="none">To unsubscribe, visit link above, or email<br clear="none"><a shape="rect" href="mailto:libav-user-request@ffmpeg.org" rel="nofollow" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br clear="none"></div></div><div class="ydpc59a44d0yqt7787062198" id="ydpc59a44d0yqt22355"><br></div><div class="ydpc59a44d0yqt7787062198" id="ydpc59a44d0yqt22355"><div><div style="color: rgb(0, 0, 0); font-size: 16px;">That may be, but for the time being I need to work with ffmpeg libraries directly. Any help with my current diretion would be appreciated.</div><div style="color: rgb(0, 0, 0); font-size: 16px;"><br></div><div dir="ltr" data-setdir="false" style="color: rgb(0, 0, 0); font-size: 16px;">Hillel</div></div></div>
            </div>
        </div></body></html>