Page 1 of 1

Audio Number of Samples or Duration

Posted: 30 Dec 2014 20:29
by jobeninc
Via libvlc, commandline, or combination of the two, is there a way to read/estimate the number of audio samples a file contains?

I am attempting to estimate the number of audio samples based on the duration of the audio in a variety of file containers.

I have been using libvlc_media_get_duration and libvlc_media_player_get_length after parsing to get the duration but it does not seem to be accurate for some file types.
- Most .ogg test files have had duration = 0
- Also the duration was inaccurate for other test files: .avi, .aac, .aiff, .etc

When using ffmpeg, I can use 'ffmpeg -i sample.ogg' to retrieve the duration. Is there a way I can come across the same information using VLC?

For context, the application I am working on uses (minus typos) : 'vlc -I dummy -vvv --no-sout-video --no-sout-smem-time-sync --sout-audio --sout #transcode{acodec=s16l}:smem{audio-postrender-callback={0},audio-pretender-callback={1}'.

Ultimately, I am attempting to estimate the size of the transcoded audio prior to completely processing the file, but I welcome any suggestions even if they included an additional instance of vlc.

Thanks!

Re: Audio Number of Samples or Duration

Posted: 02 Jan 2015 18:20
by Jean-Baptiste Kempf
Duration, you can.

For ogg, VLC 2.2.0 should fix it.

Re: Audio Number of Samples or Duration

Posted: 08 Jan 2015 21:58
by jobeninc
VLC 2.2.0 corrected the issues I experienced with ogg and some other file types. Thanks, VLC is great!

FYI, the duration given for .avi files still seems to be rounded to the nearest second.
libvlc_media_get_duration & livvlc_media_player_get_length both experience the issue.

Tested on Windows 7 64bit.
Tested with 10+ avi files originating from separate devices.

Re: Audio Number of Samples or Duration

Posted: 18 Jan 2015 08:11
by Jean-Baptiste Kempf
Please share a file, a code sample, and more info. about the lengths.
But seeing the AVI code, it seems the length is only computed to the second, indeed.
So you should create a bugreport.