From: Martijn van Beurden <mvanb1@gmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH 3/3] lavc/encode: pick a sane default for bits_per_raw_sample if it's not set Date: Sun, 23 Jan 2022 14:15:53 +0100 Message-ID: <CADQbU6-fU7MMX26VMHg0yG5NZFUstW30eJhe16maMMyOBLYxRg@mail.gmail.com> (raw) In-Reply-To: <164271348312.23111.1441973187508043407@lain.red.khirnov.net> Op do 20 jan. 2022 22:18 schreef Anton Khirnov <anton@khirnov.net>: > Quoting Martijn van Beurden (2022-01-20 19:58:54) > > Op do 20 jan. 2022 om 17:05 schreef Anton Khirnov <anton@khirnov.net>: > > > > > Fixes #9563. > > > --- > > > libavcodec/encode.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff --git a/libavcodec/encode.c b/libavcodec/encode.c > > > index b6f81d1458..44ab81af3f 100644 > > > --- a/libavcodec/encode.c > > > +++ b/libavcodec/encode.c > > > @@ -535,6 +535,9 @@ static int encode_preinit_audio(AVCodecContext > *avctx) > > > return AVERROR(EINVAL); > > > } > > > > > > + if (!avctx->bits_per_raw_sample) > > > + avctx->bits_per_raw_sample = 8 * > > > av_get_bytes_per_sample(avctx->sample_fmt); > > > + > > > return 0; > > > } > > > > > > > This creates a new regression: now 24-bit WAV files are converted to > 32-bit > > WavPack files. I think I found the cause of the problem though: the issue > > is that wavpack uses sample format s32p and 24-bit wav files use s32. > > Therefore, a aresample filter is auto-inserted to convert s32p to s32, > > which causes ost->filter->graph->is_meta to be false. > > You can work around this by using the -bits_per_raw_sample option. > Handling this in a more automagic manner would be complicated - we could > propagate bits_per_raw_sample through lavfi or add it to AVFrame. > I think this patch shouldn't be applied. Without it 32 bit audio is transcoded to 24 bit audio, which is not lossless. However, with this patch 24 bit audio is transcoded to 32 bit audio which is lossless, but the resulting files are understood by few software decoder and probably no hardware decoders. Perhaps adding a warning instead of setting a default would be better? > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-01-23 13:16 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-20 16:05 [FFmpeg-devel] [PATCH 1/3] lavc/encode: factor audio/video-specific parts out of ff_encode_preinit() Anton Khirnov 2022-01-20 16:05 ` [FFmpeg-devel] [PATCH 2/3] lavc/encode: reindent Anton Khirnov 2022-01-20 16:05 ` [FFmpeg-devel] [PATCH 3/3] lavc/encode: pick a sane default for bits_per_raw_sample if it's not set Anton Khirnov 2022-01-20 18:58 ` Martijn van Beurden 2022-01-20 21:18 ` Anton Khirnov 2022-01-23 13:15 ` Martijn van Beurden [this message] 2022-01-23 20:01 ` Anton Khirnov 2022-01-20 21:18 ` Martijn van Beurden 2022-02-20 14:19 ` Anton Khirnov 2022-02-20 17:05 ` Paul B Mahol 2022-04-06 11:24 ` Paul B Mahol 2022-04-13 10:57 ` Anton Khirnov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CADQbU6-fU7MMX26VMHg0yG5NZFUstW30eJhe16maMMyOBLYxRg@mail.gmail.com \ --to=mvanb1@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git