5
$\begingroup$

I was making a video by combining some images and this audio, when I encounter the problem:

I need to get the duration of the audio, and when I use Duration function or just import it, mma tells me that it remains about 8m01s.

But when I open it with potplayer or Groove music, it remains 7m59s. After comparing them I found that the last 2s is silent.

So why and how to import the audio the same as above? Someone told me that when he use ffmpeg, it gives 7m59s but warns:

Estimating duration from bitrate, this may be inaccurate.

I think maybe it is about encoding or so, but I am not familiar with it. Can anyone help me?

Code:(I upload the audio at somewhere because I don't know how to upload it at this cite.)

url = "https://raw.githubusercontent.com/SHBookP/SHBookP/main/azz.mp3";
Import[url](*an 8m01s audio*)
Import[url, "Duration"](*481.306*)
SystemOpen@URLDownload@url(*the end of it is 7:59*)
$\endgroup$
1
  • 2
    $\begingroup$ I reproduce the issue with version 13.0.0 on Windows 10 x64. VLC player also reports the duration of 7:59 for the audio. Looks like a bug. $\endgroup$ Jan 26 at 8:14

1 Answer 1

6
$\begingroup$

I reproduce the issue with version 13.0.0 on Windows 10 x64. The last 2 seconds are indeed silent:

audio = Import["https://raw.githubusercontent.com/SHBookP/SHBookP/main/azz.mp3"];
sr = SampleRate /. Options[audio]
last2sec = AudioData[audio][[All, -2*sr ;;]];
Max[Abs[last2sec]]
44100
0.` 

Plot last three seconds of the sum of the channels:

ListLinePlot[Plus @@ AudioData[audio][[All, -(3*sr) ;;]], PlotRange -> All, 
 DataRange -> {-3, 0}, AxesLabel -> {"Seconds", "Sum of the channels"}]

plot

Looks like a bug. Please report it to the support.

$\endgroup$
1
  • 2
    $\begingroup$ OK, thanks. I've voted and reported it by email. $\endgroup$
    – SHBooKP
    Jan 26 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.