feat(streamer): add ffmpeg encoder and mcap recording
This commit is contained in:
@@ -25,9 +25,34 @@ enum class RtmpMode {
|
||||
Domestic,
|
||||
};
|
||||
|
||||
enum class EncoderBackendType {
|
||||
Auto,
|
||||
FFmpeg,
|
||||
GStreamerLegacy,
|
||||
};
|
||||
|
||||
enum class EncoderDeviceType {
|
||||
Auto,
|
||||
Nvidia,
|
||||
Software,
|
||||
};
|
||||
|
||||
enum class McapCompression {
|
||||
None,
|
||||
Lz4,
|
||||
Zstd,
|
||||
};
|
||||
|
||||
struct InputConfig {
|
||||
std::string shm_name{"cvmmap_default"};
|
||||
std::string zmq_endpoint{"ipc:///tmp/cvmmap_default"};
|
||||
std::string uri{"cvmmap://default"};
|
||||
};
|
||||
|
||||
struct EncoderConfig {
|
||||
EncoderBackendType backend{EncoderBackendType::Auto};
|
||||
EncoderDeviceType device{EncoderDeviceType::Auto};
|
||||
CodecType codec{CodecType::H264};
|
||||
std::uint32_t gop{30};
|
||||
std::uint32_t b_frames{0};
|
||||
};
|
||||
|
||||
struct RtmpOutputConfig {
|
||||
@@ -50,10 +75,20 @@ struct OutputsConfig {
|
||||
RtpOutputConfig rtp{};
|
||||
};
|
||||
|
||||
struct McapRecordConfig {
|
||||
bool enabled{false};
|
||||
std::string path{"capture.mcap"};
|
||||
std::string topic{"/camera/video"};
|
||||
std::string frame_id{"camera"};
|
||||
McapCompression compression{McapCompression::Zstd};
|
||||
};
|
||||
|
||||
struct RecordConfig {
|
||||
McapRecordConfig mcap{};
|
||||
};
|
||||
|
||||
struct LatencyConfig {
|
||||
std::size_t queue_size{1};
|
||||
std::uint32_t gop{30};
|
||||
std::uint32_t b_frames{0};
|
||||
bool realtime_sync{true};
|
||||
bool force_idr_on_reset{true};
|
||||
std::uint32_t ingest_max_frames{0};
|
||||
@@ -66,8 +101,9 @@ struct LatencyConfig {
|
||||
struct RuntimeConfig {
|
||||
InputConfig input{};
|
||||
RunMode run_mode{RunMode::Pipeline};
|
||||
CodecType codec{CodecType::H264};
|
||||
EncoderConfig encoder{};
|
||||
OutputsConfig outputs{};
|
||||
RecordConfig record{};
|
||||
LatencyConfig latency{};
|
||||
|
||||
static RuntimeConfig defaults();
|
||||
@@ -76,6 +112,9 @@ struct RuntimeConfig {
|
||||
std::string_view to_string(CodecType codec);
|
||||
std::string_view to_string(RunMode mode);
|
||||
std::string_view to_string(RtmpMode mode);
|
||||
std::string_view to_string(EncoderBackendType backend);
|
||||
std::string_view to_string(EncoderDeviceType device);
|
||||
std::string_view to_string(McapCompression compression);
|
||||
|
||||
std::expected<RuntimeConfig, std::string> parse_runtime_config(int argc, char **argv);
|
||||
std::expected<void, std::string> validate_runtime_config(const RuntimeConfig &config);
|
||||
|
||||
Reference in New Issue
Block a user