You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
781 B
29 lines
781 B
#include <fmt/core.h>
|
|
#include "dbc.hpp"
|
|
|
|
#define BUF_MAX 1024 * 10
|
|
using namespace fmt;
|
|
|
|
const string TWITCH_BR="7M";
|
|
|
|
FILE *run_ffmpeg() {
|
|
string ffmpeg_cmd = format("ffmpeg -listen 1 -i rtmp://192.168.254.146/ -bufsize 3000k -maxrate $twitch_br -flags +global_header -c:v libx264 -preset veryfast -tune zerolatency -g:v 60 -vb $twitch_br -c:a copy -f flv $twitch");
|
|
|
|
FILE *handle = popen(ffmpeg_cmd.c_str(), "r");
|
|
dbc::check(handle != nullptr, "failed to start ffmpeg");
|
|
return handle;
|
|
}
|
|
|
|
int main() {
|
|
FILE *handle = run_ffmpeg();
|
|
char buffer[BUF_MAX];
|
|
char *res = nullptr;
|
|
|
|
do {
|
|
res = fgets(buffer, BUF_MAX, handle);
|
|
print("OUT: {}", res);
|
|
} while(res != nullptr);
|
|
|
|
int rc = pclose(handle);
|
|
dbc::check(rc == 0, "error closing ffmpeg");
|
|
}
|
|
|