mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-07 01:03:07 +08:00
Code refactoring for FFmpeg producer
This commit is contained in:
@@ -92,8 +92,6 @@ var defaults = map[string]string{
|
|||||||
"pcml/8000": "-c:a pcm_s16le -ar:a 8000 -ac:a 1",
|
"pcml/8000": "-c:a pcm_s16le -ar:a 8000 -ac:a 1",
|
||||||
"pcml/44100": "-c:a pcm_s16le -ar:a 44100 -ac:a 1",
|
"pcml/44100": "-c:a pcm_s16le -ar:a 44100 -ac:a 1",
|
||||||
|
|
||||||
"opus/48000/2": "-c:a libopus -application:a lowdelay -min_comp 0 -ar:a 48000 -ac:a 2",
|
|
||||||
|
|
||||||
// hardware Intel and AMD on Linux
|
// hardware Intel and AMD on Linux
|
||||||
// better not to set `-async_depth:v 1` like for QSV, because framedrops
|
// better not to set `-async_depth:v 1` like for QSV, because framedrops
|
||||||
// `-bf 0` - disable B-frames is very important
|
// `-bf 0` - disable B-frames is very important
|
||||||
|
@@ -34,16 +34,19 @@ func NewProducer(url string) (core.Producer, error) {
|
|||||||
p.Type = "FFmpeg producer"
|
p.Type = "FFmpeg producer"
|
||||||
p.Medias = []*core.Media{
|
p.Medias = []*core.Media{
|
||||||
{
|
{
|
||||||
|
// we can support only audio, because don't know FmtpLine for H264 and PayloadType for MJPEG
|
||||||
Kind: core.KindAudio,
|
Kind: core.KindAudio,
|
||||||
Direction: core.DirectionRecvonly,
|
Direction: core.DirectionRecvonly,
|
||||||
|
// codecs in order from best to worst
|
||||||
Codecs: []*core.Codec{
|
Codecs: []*core.Codec{
|
||||||
|
// OPUS will always marked as OPUS/48000/2
|
||||||
{Name: core.CodecOpus, ClockRate: 48000, Channels: 2},
|
{Name: core.CodecOpus, ClockRate: 48000, Channels: 2},
|
||||||
{Name: core.CodecAAC, ClockRate: 16000, FmtpLine: aac.FMTP + "1408"},
|
{Name: core.CodecAAC, ClockRate: 16000, FmtpLine: aac.FMTP + "1408"},
|
||||||
{Name: core.CodecPCM, ClockRate: 16000},
|
{Name: core.CodecPCM, ClockRate: 16000},
|
||||||
{Name: core.CodecPCM, ClockRate: 8000},
|
|
||||||
{Name: core.CodecPCMA, ClockRate: 16000},
|
{Name: core.CodecPCMA, ClockRate: 16000},
|
||||||
{Name: core.CodecPCMA, ClockRate: 8000},
|
|
||||||
{Name: core.CodecPCMU, ClockRate: 16000},
|
{Name: core.CodecPCMU, ClockRate: 16000},
|
||||||
|
{Name: core.CodecPCM, ClockRate: 8000},
|
||||||
|
{Name: core.CodecPCMA, ClockRate: 8000},
|
||||||
{Name: core.CodecPCMU, ClockRate: 8000},
|
{Name: core.CodecPCMU, ClockRate: 8000},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -96,7 +99,7 @@ func (p *Producer) newURL() string {
|
|||||||
case core.CodecAAC:
|
case core.CodecAAC:
|
||||||
s += "#audio=aac/16000"
|
s += "#audio=aac/16000"
|
||||||
case core.CodecOpus:
|
case core.CodecOpus:
|
||||||
s += "#audio=opus/48000/2"
|
s += "#audio=opus"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add other params
|
// add other params
|
||||||
|
Reference in New Issue
Block a user