'ffmpeg Padding & Delay to Audio File Accurately
Recently I've been doing a personal project which does entail a little bit of audio handling but I have noticed that the commands that I am using to modify don't have a 1:1 correlation in the resulting file leading to it being fairly offbeat (Note that this program is error sensitive).
All I need to do is accurately add Padding to the start of an audio file, or jumpforward to some point in the song using an Offset/Delay value. The values are strictly accurate such as 0.13149s however accuracy passed the third radix is pretty redundant since 'nobody' should be able to notice it.
Here is an example of one issue:
[Input File Info] // This is a test case/correct values
Supposed to start at : 0.875
Originally started at: 1.190
Offset Value : -0.315
Difference : 1.190 - 0.875 = 0.315
// Audio file offset attempt (FAIL)
FFMPEG Command:
ffmpeg -y -i "..." -ss 0.315 -c copy -map 0 "..."
[Output File Info]
Start Time Beat : 0.766
Start Time Beat Audacity: 0.766
Resulting Error : 0.106
What I want to know is if someone knows a better way to get 1:1 accuracy from the command or atleast as close to it as possible. I don't often use ffmpeg so I probably am missing vital information (I did my best googling ok :) but to this I also wouldn't abstain from using a dedicated audio library for the language I'm writing the program in (Java).
I probably should mention that I have been using:
ffmpeg -y -i "..." -af "adelay=DELAY" "..."
to add the padding but I haven't really gotten around to testing audio files
that require this yet so I don't know if its broken/inaccurate.
Solution 1:[1]
I believe atrim filter gives you accurate results:
ffmpeg -i INPUT -af atrim=start=0.315 OUTPUT
This is likely equivalent to using the -ss output option.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | kesh |
