[Libav-user] How to handle files with variable sample rate?

drwho drwho at infidigm.net
Sat Sep 18 23:59:25 EEST 2021


In AVR (Audio Visual Receivers) DSPs the incoming I2S sample rate (left 
right clock) of DTS 96/24 is 48Khz, compressed audio.  After decoding 
(now PCM), the output I2S sample rate is 96khz.

Jon

On 2021-09-18 1:24 p.m., Kitchen PC wrote:
> Hi,
>
> I've got a .dts file, which I'm decoding using FFmpeg libraries.
> The file is detected as DTS 96/24, which would be fine, but the thing 
> is that only some first frames have sample_rate 96000 while all the 
> rest ones have sample_rate 48000.
> As a result the decoded audio is assumed to be 96000, but in the 
> reality it's 48000 and it plays back at wrong speed.
>
> FFmpeg handles this file fine, the result output is 96Khz audio, 
> played at a proper speed.
>
> My question is how to handle files like this? Do I need to re-sample 
> those frames to the 96000 or that can be handled via FFmpeg automatically?
>
> I modified ffprobe to print the sample_rate for each frame, as it does 
> not it by default, and the output is like this:
>
> ffprobe.exe -v debug -show_frames -show_format file.dts
>
> ...
> up until this all frames are 96000
> ...
> media_type=audio
> stream_index=0
> sample_rate=96000 -- !
> key_frame=1
> pts=132480
> pts_time=1.472000
> pkt_dts=132480
> pkt_dts_time=1.472000
> best_effort_timestamp=132480
> best_effort_timestamp_time=1.472000
> pkt_duration=960
> pkt_duration_time=0.010667
> pkt_pos=277794
> pkt_size=2013
> sample_fmt=fltp
> nb_samples=1024
> channels=6
> channel_layout=5.1(side)
> [SIDE_DATA]
> side_data_type=AVMatrixEncoding
> [/SIDE_DATA]
> [/FRAME]
>
> And starting from here, all the following frames have sample_rate 48000
>
> [FRAME]
> media_type=audio
> stream_index=0
> sample_rate=48000 -- !
> key_frame=1
> pts=133440
> pts_time=1.482667
> pkt_dts=133440
> pkt_dts_time=1.482667
> best_effort_timestamp=133440
> best_effort_timestamp_time=1.482667
> pkt_duration=960
> pkt_duration_time=0.010667
> pkt_pos=279807
> pkt_size=2013
> sample_fmt=fltp
> nb_samples=512
> channels=6
> channel_layout=5.1(side)
> [SIDE_DATA]
> side_data_type=AVMatrixEncoding
> [/SIDE_DATA]
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210918/afd94a21/attachment.htm>


More information about the Libav-user mailing list