|
|
|
@ -93,6 +93,7 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc, |
|
|
|
|
enum AVCodecID codec_id) |
|
|
|
|
{ |
|
|
|
|
AVCodecContext *c; |
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
/* find the encoder */ |
|
|
|
|
*codec = avcodec_find_encoder(codec_id); |
|
|
|
@ -116,8 +117,15 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc, |
|
|
|
|
(*codec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP; |
|
|
|
|
c->bit_rate = 64000; |
|
|
|
|
c->sample_rate = 44100; |
|
|
|
|
c->channels = 2; |
|
|
|
|
c->channel_layout = AV_CH_LAYOUT_STEREO; |
|
|
|
|
if ((*codec)->channel_layouts) { |
|
|
|
|
c->channel_layout = (*codec)->channel_layouts[0]; |
|
|
|
|
for (i = 0; (*codec)->channel_layouts[i]; i++) { |
|
|
|
|
if ((*codec)->channel_layouts[i] == AV_CH_LAYOUT_STEREO) |
|
|
|
|
c->channel_layout = AV_CH_LAYOUT_STEREO; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
c->channels = av_get_channel_layout_nb_channels(c->channel_layout); |
|
|
|
|
ost->st->time_base = (AVRational){ 1, c->sample_rate }; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|