Audio Number of Samples or Duration

This forum is about all development around libVLC.
jobeninc
New Cone
New Cone
Posts: 2
Joined: 30 Dec 2014 19:43

Audio Number of Samples or Duration

Postby jobeninc » 30 Dec 2014 20:29

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!

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Audio Number of Samples or Duration

Postby Jean-Baptiste Kempf » 02 Jan 2015 18:20

Duration, you can.

For ogg, VLC 2.2.0 should fix it.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

jobeninc
New Cone
New Cone
Posts: 2
Joined: 30 Dec 2014 19:43

Re: Audio Number of Samples or Duration

Postby jobeninc » 08 Jan 2015 21:58

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.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Audio Number of Samples or Duration

Postby Jean-Baptiste Kempf » 18 Jan 2015 08:11

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.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Development around libVLC”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 20 guests