Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 30th May 2023, 04:55   #1  |  Link
SilSinn9801
Chiptuner & VapourSynther
 
SilSinn9801's Avatar
 
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
How to do nearest-neighbor audio upsampling in FFmpeg?

Hello,

I have hundreds of one-minute-long MP4 files ripped from a WYZE security camera, & their monaural audio is encoded in A-Law ADPCM at 16000 Hz. I want to batch-decode the audio from all those 100s of MP4s to PCM (16-bit signed, little endian) & then batch-upsample from 16000 to 48000 Hz WITHOUT interpolation of any kind – that is, nearest-neighbor upsampling (instead of linear, cubic, or any other form of sample interpolation), & because 48000 is an integer multiple of 16000 (3× to be exact), the output should have no rounding errors. Effectively, I want each input sample value to repeat three times at the output before moving from one audio sample point to the next. The question is, how do I batch-do this in FFmpeg?

For context: trying FFmpeg’s -ar 48000 option always results in linear interpolation (or something close to it) between sample points, & trying instead
Code:
-af aresample=isr=16000:linear_interp=0:osr=48000
also always results in linear upsampling (in spite of the linear_interp=0 part, unless that part means a different thing).
__________________
SilSinn9801 a.k.a. Silent Sinner in Scarlet
Discord: silsinn9801
Matrix: silsinn9821:matrix.org
YouTube: https://youtube.com/SilentSinnerInScarlet
ニコニコ動画: https://nicovideo.jp/user/68029427

Last edited by SilSinn9801; 30th May 2023 at 05:13. Reason: adding for context the behavior of both "-ar 48000" & "-af aresample" options in FFmpeg; fixing formatting from [CODE/] to [FONT/]
SilSinn9801 is offline   Reply With Quote
 

Tags
ffmpeg audio, interpolation, nearest neighbor, nearest neighbour, upsampling

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:40.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.