正在显示
1 个修改的文件
包含
29 行增加
和
15 行删除
@@ -330,21 +330,21 @@ int SrsFFMPEG::start() | @@ -330,21 +330,21 @@ int SrsFFMPEG::start() | ||
330 | } | 330 | } |
331 | 331 | ||
332 | // the codec params is disabled when copy | 332 | // the codec params is disabled when copy |
333 | - if (acodec != SRS_RTMP_ENCODER_COPY && acodec != SRS_RTMP_ENCODER_NO_AUDIO) { | ||
334 | - params.push_back("-b:a"); | ||
335 | - snprintf(tmp, sizeof(tmp), "%d", abitrate * 1000); | ||
336 | - params.push_back(tmp); | ||
337 | - | ||
338 | - params.push_back("-ar"); | ||
339 | - snprintf(tmp, sizeof(tmp), "%d", asample_rate); | ||
340 | - params.push_back(tmp); | ||
341 | - | ||
342 | - params.push_back("-ac"); | ||
343 | - snprintf(tmp, sizeof(tmp), "%d", achannels); | ||
344 | - params.push_back(tmp); | ||
345 | - | ||
346 | - // aparams | ||
347 | - if (!aparams.empty()) { | 333 | + if (acodec != SRS_RTMP_ENCODER_NO_AUDIO) { |
334 | + if (acodec != SRS_RTMP_ENCODER_COPY) { | ||
335 | + params.push_back("-b:a"); | ||
336 | + snprintf(tmp, sizeof(tmp), "%d", abitrate * 1000); | ||
337 | + params.push_back(tmp); | ||
338 | + | ||
339 | + params.push_back("-ar"); | ||
340 | + snprintf(tmp, sizeof(tmp), "%d", asample_rate); | ||
341 | + params.push_back(tmp); | ||
342 | + | ||
343 | + params.push_back("-ac"); | ||
344 | + snprintf(tmp, sizeof(tmp), "%d", achannels); | ||
345 | + params.push_back(tmp); | ||
346 | + | ||
347 | + // aparams | ||
348 | std::vector<std::string>::iterator it; | 348 | std::vector<std::string>::iterator it; |
349 | for (it = aparams.begin(); it != aparams.end(); ++it) { | 349 | for (it = aparams.begin(); it != aparams.end(); ++it) { |
350 | std::string p = *it; | 350 | std::string p = *it; |
@@ -352,6 +352,20 @@ int SrsFFMPEG::start() | @@ -352,6 +352,20 @@ int SrsFFMPEG::start() | ||
352 | params.push_back(p); | 352 | params.push_back(p); |
353 | } | 353 | } |
354 | } | 354 | } |
355 | + } else { | ||
356 | + // for audio copy. | ||
357 | + for (int i = 0; i < (int)aparams.size();) { | ||
358 | + std::string pn = aparams[i++]; | ||
359 | + | ||
360 | + // aparams, the adts to asc filter "-bsf:a aac_adtstoasc" | ||
361 | + if (pn == "-bsf:a" && i < (int)aparams.size()) { | ||
362 | + std::string pv = aparams[i++]; | ||
363 | + if (pv == "aac_adtstoasc") { | ||
364 | + params.push_back(pn); | ||
365 | + params.push_back(pv); | ||
366 | + } | ||
367 | + } | ||
368 | + } | ||
355 | } | 369 | } |
356 | } | 370 | } |
357 | 371 |
-
请 注册 或 登录 后发表评论