<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 9/10/2016 12:56 AM, Timur Guseynov
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAFHvtXddp-Do7yuzu05oW=apxp3WdrunCSsjjftRRw_uhkke6w@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi. 
        <div><br>
        </div>
        <div>I am new to C++ and FFmpeg and wanted to write application
          that streams video from camera (webcam at least) to some
          server.</div>
        <div><br>
        </div>
        <div>I've seen <a moz-do-not-send="true"
            href="https://trac.ffmpeg.org/wiki/StreamingGuide">StreamingGuide</a> and
          wanted to know how to implement it. </div>
        <div>I think that basic flow is like this, please correct me if
          I'm wrong:</div>
        <div>
          <ol>
            <li>Get input device AVInputFormat from libavdevice</li>
            <li>Open that input with avformat_open_input</li>
            <li>Find its streams' codecs</li>
            <li>Get decoder with avcodec_find_decoder</li>
            <li>Decode it somehow</li>
            <li>Encode it for stream</li>
            <li>Write data with muxer</li>
            <li>Send muxed data to server</li>
          </ol>
          <div>So I imagine how to implement the first half of this list
            but not the second. </div>
        </div>
        <div><br>
        </div>
        <div>2 questions that I have are:<br>
        </div>
        <div>
          <ol>
            <li>Do I understand the streaming flow right? What are the
              nuances that I must consider? What modules/methods should
              I look into to implement it?</li>
            <li>How can I do a preview of stream in a GUI using, for
              example, Qt Quick? Is an input device blocked by one of
              the processes (either FFmpeg or Qt)? If it is, should I
              somehow copy frames for GUI to show them for user or just
              reference it?</li>
          </ol>
          <div>Thanks in advance!</div>
        </div>
        <div><br>
        </div>
        <div>Kind regards,</div>
        <div>Timur Guseynov</div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Libav-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a class="moz-txt-link-freetext" href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>
</pre>
    </blockquote>
    <p>That is pretty close if you want to display it in a gui.</p>
    <p>To display it you just draw the decoded bytes to some hardware
      overlay. And yes, typically only one application can acquire the
      capture stream output at a time. You can register pseudo input
      devices which distribute the output of an actual camera. There are
      products available that do this. <br>
    </p>
    <p>For the server, you could set up a output for rtmp or rtsp and
      then write the encoded av packets to it.</p>
    <p>Have Fun!</p>
    <p>Andy<br>
    </p>
  </body>
</html>