<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [TOC] # MacOS ## 設備枚舉 查看設備列表 ``` $ ffmpeg -hide_banner -devices Devices: D. = Demuxing supported .E = Muxing supported -- D avfoundation AVFoundation input device D lavfi Libavfilter virtual input device E sdl,sdl2 SDL2 output device ``` 可以看到輸入設備有:avfoundation,lavfi 輸出設備有:sdl ` ` 設備采集舉例: ``` $ ffmpeg -f avfoundation -list_devices true -i " " ``` 看到了 如下設備 ``` [AVFoundation input device @ 0x7fac75c048c0] AVFoundation video devices: [AVFoundation input device @ 0x7fac75c048c0] [0] FaceTime高清攝像頭(內建) [AVFoundation input device @ 0x7fac75c048c0] [1] Capture screen 0 [AVFoundation input device @ 0x7fac75c048c0] AVFoundation audio devices: [AVFoundation input device @ 0x7fac75c048c0] [0] Built-in Microphone ``` ## 采集攝像頭 采集內置攝像頭 ``` $ ffmpeg -f avfoundation -i "FaceTime高清攝像頭" out.mp4 //或者使用索引號 0 來代替攝像頭設備名稱 ffmpeg -f avfoundation -i 0 out.mp4 [avfoundation @ 0x7fbf16808200] Selected framerate (29.970030) is not supported by the device. [avfoundation @ 0x7fbf16808200] Supported modes: [avfoundation @ 0x7fbf16808200] 640x480@[30.000030 30.000030]fps [avfoundation @ 0x7fbf16808200] 640x480@[29.000049 29.000049]fps [avfoundation @ 0x7fbf16808200] 640x480@[28.000067 28.000067]fps [avfoundation @ 0x7fbf16808200] 640x480@[27.000027 27.000027]fps [avfoundation @ 0x7fbf16808200] 640x480@[26.000026 26.000026]fps [avfoundation @ 0x7fbf16808200] 640x480@[25.000000 25.000000]fps ``` 日志告訴我們 *Selected framerate (29.970030) is not supported by the device* ,默認的framerate 不被設備支持,下面也給出了支持的分辨率和framerate 所以我們要改一下命令,選取第一個吧 *640x480@\[30.000030 30.000030\]fps* ``` ffmpeg -f avfoundation -video_size 640x480 -framerate 30 -i "FaceTime高清攝像頭" out.mp4 ``` 把攝像頭和麥克風的數據存到一個文件里 ``` ffmpeg -f avfoundation -video_size 640x480 -framerate 30 -video_device_index 0 -i ":0" out.mp4 //或者 ffmpeg -f avfoundation -video_size 640x480 -framerate 30 -i "0:0" out.mp4 ``` 播放錄制的視頻數據 ``` ffplay out.mp4 ``` ## 采集桌面 ``` ffmpeg -f avfoundation -i "Capture screen 0" -r:v 30 screen.mp4 //或者使用索引號1 來代替屏幕設備名稱 ffmpeg -f avfoundation -i 1 -r:v 30 screen.mp4 ``` 播放采集到的桌面數據 ``` ffplay screen.mp4 ``` 參數"Capture screen 0"指定了輸入設備,我們也可以將桌面圖像帶上鼠標一起錄制下來,加上參數-capture_cursor ``` ffmpeg -f avfoundation -capture-cursor 1 -i "Capture screen 0" -r:v 30 screen.mp4 ``` 然后播放screen.mp4驗證。`ffplay screen.mp4` # Windows ## 概述 FFmpeg Windows 設備操作 Windows 采集設備的主要方式是 dshow vfwcap gdigrab 其中 * **dshow 可以用來抓 取攝像頭、采集卡、麥克風等**, * **vfwcap 主要用來采集攝像頭類設備**, * **gdigrab 則是抓取 Windows 窗口程序** ## FFmpeg 使用 dshow 采集音視頻設備 使用 dshow 枚舉設備 ``` ffmpeg -f dshow -list_devices true -i dymmy ``` 輸出 ``` [dshow @ 000002622302e340] DirectShow video devices (some may be both video and audio devices) [dshow @ 000002622302e340] "Altair USB2.0 Camera" [dshow @ 000002622302e340] Alternative name "@device_pnp_\\?\usb#vid_0ac8&pid_3450&mi_00#6&3b01315a&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global" [dshow @ 000002622302e340] DirectShow audio devices ``` ` ` 使用 dshow 展示攝像頭, 攝像頭的參數為 video="攝像頭名稱" ``` ffplay -f dshow -i video="Altair USB2.0 Camera" ``` ` ` 獲得攝像頭支持的分辨率 ``` ffmpeg -list_options true -f dshow -i video="Altair USB2.0 Camera" ``` 輸出 ``` [dshow @ 000001b88b90e380] DirectShow video device options (from video devices) [dshow @ 000001b88b90e380] Pin "捕獲" (alternative pin name "0") [dshow @ 000001b88b90e380] pixel_format=yuyv422 min s=640x480 fps=15 max s=640x480 fps=30 [dshow @ 000001b88b90e380] pixel_format=yuyv422 min s=640x480 fps=15 max s=640x480 fps=30 [dshow @ 000001b88b90e380] pixel_format=yuyv422 min s=352x288 fps=15 max s=352x288 fps=30 [dshow @ 000001b88b90e380] pixel_format=yuyv422 min s=352x288 fps=15 max s=352x288 fps=30 [dshow @ 000001b88b90e380] pixel_format=yuyv422 min s=320x240 fps=30 max s=320x240 fps=60.0002 [dshow @ 000001b88b90e380] pixel_format=yuyv422 min s=320x240 fps=30 max s=320x240 fps=60.0002 [dshow @ 000001b88b90e380] pixel_format=yuyv422 min s=176x144 fps=30 max s=176x144 fps=60.0002 [dshow @ 000001b88b90e380] pixel_format=yuyv422 min s=176x144 fps=30 max s=176x144 fps=60.0002 [dshow @ 000001b88b90e380] pixel_format=yuyv422 min s=160x120 fps=30 max s=160x120 fps=60.0002 [dshow @ 000001b88b90e380] pixel_format=yuyv422 min s=160x120 fps=30 max s=160x120 fps=60.0002 ``` 可以加上分辨率的參數 **-video_size** ``` ffplay -f dshow -video_size 640x480 -i video="Altair USB2.0 Camera" ``` ## FFmpeg 使用 vfwcap 采集視頻設備 vfwcap 主要支持兩個參數 video_size framerate ,分別指示采集圖像的大小和幀率 使用 vfwcap 枚舉支持采集的設備 ``` ffmpeg -f vfwcap -i list ``` 輸出 ``` [vfwcap @ 0000025a6d60d080] Driver 0 [vfwcap @ 0000025a6d60d080] Microsoft WDM Image Capture (Win32) [vfwcap @ 0000025a6d60d080] Version: 10.0.17134.1 list: I/O error ``` 使用 vfwcap 生成 MP4 文件 ``` ffmpeg -f vfwcap -i 0 -r 25 -vcodec libx264 out.mp4 ``` 我們通過 -i 指定了待錄像的攝像頭 索引號,-r 則指定了 需要錄像 的幀, -vcodec 指定了錄像視頻的編碼格式,輸出 out.mp4 ## FFmpeg 使用 gdigrab 采集窗口 Windows 平臺, FFmpeg 支持采集基于 gdi 的屏幕采集設備,這個設備同時支持采 集顯示器的某 塊區域, gdigrab 支持的主要參數如表 7-5 所示 ![wQ5oqg.png](https://s1.ax1x.com/2020/09/08/wQ5oqg.png) gdigrab 的輸入主要有兩種方式: 1. desktop title = window_title ,其中 desktop 代表采 集整個桌面, 2. ttitle = window title 則是采集標題為 window title 的窗口 使用 gdigrab 采集整個桌面 ``` ffmpeg -f gdigrab -framerate 6 -i desktop screen.mp4 ``` 使用gdigrab采集某個窗口 ``` ffmpeg -f gdigrab -framerate 6 -i title="60.191.222.70 - @TTR-TEST: ~/DetectAV/src/LiveDetect - Xshell 6" gdi.mp4 ``` 該窗口是我用spy++抓的 ![w1PKVH.png](https://s1.ax1x.com/2020/09/09/w1PKVH.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看