mirror of
https://github.com/Genymobile/scrcpy.git
synced 2024-09-19 05:31:21 +02:00
rtmp-wip
Run: scrcpy -ra.mp4 --audio-codec=aac (the filename is ignored, but the command line parser must be happy, and opus is not supported by flv)
This commit is contained in:
parent
22d78e8a82
commit
84be93ce3f
1 changed files with 8 additions and 3 deletions
|
@ -9,6 +9,8 @@
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/str.h"
|
#include "util/str.h"
|
||||||
|
|
||||||
|
#define RTMP_URL "rtmp://localhost/live/stream"
|
||||||
|
|
||||||
/** Downcast packet sinks to recorder */
|
/** Downcast packet sinks to recorder */
|
||||||
#define DOWNCAST_VIDEO(SINK) \
|
#define DOWNCAST_VIDEO(SINK) \
|
||||||
container_of(SINK, struct sc_recorder, video_packet_sink)
|
container_of(SINK, struct sc_recorder, video_packet_sink)
|
||||||
|
@ -131,7 +133,7 @@ static bool
|
||||||
sc_recorder_open_output_file(struct sc_recorder *recorder) {
|
sc_recorder_open_output_file(struct sc_recorder *recorder) {
|
||||||
const char *format_name = sc_recorder_get_format_name(recorder->format);
|
const char *format_name = sc_recorder_get_format_name(recorder->format);
|
||||||
assert(format_name);
|
assert(format_name);
|
||||||
const AVOutputFormat *format = find_muxer(format_name);
|
const AVOutputFormat *format = find_muxer("flv");
|
||||||
if (!format) {
|
if (!format) {
|
||||||
LOGE("Could not find muxer");
|
LOGE("Could not find muxer");
|
||||||
return false;
|
return false;
|
||||||
|
@ -143,8 +145,11 @@ sc_recorder_open_output_file(struct sc_recorder *recorder) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = avio_open(&recorder->ctx->pb, recorder->filename,
|
AVDictionary *options = NULL;
|
||||||
AVIO_FLAG_WRITE);
|
av_dict_set(&options, "listen", "1", 0); // Enable listening
|
||||||
|
|
||||||
|
int ret = avio_open2(&recorder->ctx->pb, RTMP_URL,
|
||||||
|
AVIO_FLAG_WRITE, NULL, &options);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOGE("Failed to open output file: %s", recorder->filename);
|
LOGE("Failed to open output file: %s", recorder->filename);
|
||||||
avformat_free_context(recorder->ctx);
|
avformat_free_context(recorder->ctx);
|
||||||
|
|
Loading…
Reference in a new issue