在使用以下 ffmpeg 选项进行屏幕录制时,我始终在视频之前获得音频,延迟约为几秒钟
ffmpeg 命令:
ffmpeg -y -f x11grab -thread_queue_size 1024 -draw_mouse 0 -video_size 1920x1080 -i :0 -f pulse -thread_queue_size 1024 -i default -c:v libx264 -threads 0 -preset faster -c:a flac -async 1 -vsync 1 -crf 30 -crf_max 33 -f matroska output.mkv
ffprobe 输出如下:
$ ffprobe demo.mkv
ffprobe version 3.4.4-1~16.04.york0 Copyright (c) 2007-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/usr --extra-version='1~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass …Run Code Online (Sandbox Code Playgroud) 我想使用ioctl()来获取准备读取的字节数
我这样做的方式是:
mysocket=socket(....);
ioctl(mysocket, FIONBIO, &zero);
connect(.....);
ioctl( mysocket, FIONREAD, &numBytes );
read(mysocket, buffer, numBytes);
Run Code Online (Sandbox Code Playgroud)
这在unix中工作正常,现在我必须将它移植到linux我一直得到ERROR
错误:未在此范围内声明'FIONBIO'
是否有一些特定于Linux的头文件?或者'FIOBIO'在linux中根本不起作用?
我有以下标题包括:
#include <cstring>
#include <sys/socket.h>
#include <stropts.h>
#include <fcntl.h>
#include <stddef.h>
#include <sys/un.h>
#include <sys/types.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <sys/select.h>
#include <fstream>
Run Code Online (Sandbox Code Playgroud)
我删除了
#include <sys/filio.h>
Run Code Online (Sandbox Code Playgroud)
因为它抛出了错误,说没有找到sys/filio.h
c++ ×1
ffmpeg ×1
ioctl ×1
linux ×1
matroska ×1
pulseaudio ×1
screencast ×1
sockets ×1
ubuntu ×1