[FFmpeg-devel] [PATCH] flv format support mp3 audio with 48khz

Yusuke Nakamura muken.the.vfrmaniac at gmail.com
Wed Sep 28 00:15:40 EEST 2016


2016-09-28 0:01 GMT+09:00 <fu.qiuping at hotmail.com>:

> From: frankos2 <frankqpfu at localhost.localdomain>
>
> ---
>  libavformat/flvenc.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index 99903f5..296426a 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -107,6 +107,13 @@ static int get_audio_flags(AVFormatContext *s,
> AVCodecParameters *par)
>          return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ |
> FLV_SAMPLESSIZE_16BIT;
>      } else {
>          switch (par->sample_rate) {
> +        case 48000:
> +            if (par->codec_id == AV_CODEC_ID_MP3) {
> +                flags |= FLV_SAMPLERATE_44100HZ;
> +                break;
> +            } else {
> +                goto error;
> +            }
>          case 44100:
>              flags |= FLV_SAMPLERATE_44100HZ;
>              break;
> @@ -124,6 +131,7 @@ static int get_audio_flags(AVFormatContext *s,
> AVCodecParameters *par)
>                  break;
>              }
>          default:
> +error:
>              av_log(s, AV_LOG_ERROR,
>                     "FLV does not support sample rate %d, "
>                     "choose from (44100, 22050, 11025)\n",
> par->sample_rate);
> --
> 1.7.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Out of the spec I think. Did you confirm that Adobe (Flash Player) allows
48kHz mp3? About AAC, the spec (Adobe Flash Video File Format
Specification) says the Flash Player ignores sample rate in AudioTagHeader,
which is a dummy, and extracts the actual sample rate from AAC bitstream.
But the spec does not say about MP3 in the same way.


More information about the ffmpeg-devel mailing list