[FFmpeg-user] Problem about duration value of converted mp3 file

myounggun jang jinmi80 at gmail.com
Mon Sep 14 09:31:40 EEST 2020


Dear FFmpeg user

Does anyone know anything about it?
I use the 96k option, but a difference of about 1s remains.
The file size is large, so I want to use it with more compression, but I
cannot apply it.


2020년 9월 3일 (목) 오전 11:23, myounggun jang <jinmi80 at gmail.com>님이 작성:

> Thank you for your interest
>
> The contents requested for confirmation have been retested and confirmed.
> This is the result of recording a wav file on an Android device and
> converting it on Windows PC.
>
> The length of the original file is 26:39, and the result of converting it
> to the default option is 25:47, which is displayed in Windows Explorer and
> the file size is 4,686KB.
> If this is converted using the -b:a 96k option, it has the same length as
> the original 26:39 and the file size is 18,740KB.
>
> I checked and played both the original file and the converted file using
> ocenaudio SW, it marked as 26:39 and played.
> However, the converted file by default is displayed in the time of 25:47
> in Media Player and played.
>
> Below is the console output I tested.
> I don't find any difference.
>
>
> =========================================================================================================
> defalut converting test
>
> =========================================================================================================
>
> ffmpeg.exe -i 1.wav 1_default.mp3
> ffmpeg version git-2020-08-28-ccc7120 Copyright (c) 2000-2020 the FFmpeg
> developers                                       built with gcc 10.2.1
> (GCC) 20200805
>   configuration: --enable-gpl --enable-version3 --enable-sdl2
> --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
> --enable-libdav1d --enable-libbluray --enable-libfreetype
> --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
> --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy
> --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame
> --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
> --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma
> --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf
> --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa
> --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm
> --enable-librav1e --enable-libsvtav1 --disable-w32threads --enable-libmfx
> --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va
> --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
> --enable-libopenmpt --enable-amf
>   libavutil      56. 58.100 / 56. 58.100
>   libavcodec     58.101.100 / 58.101.100
>   libavformat    58. 51.101 / 58. 51.101
>   libavdevice    58. 11.101 / 58. 11.101
>   libavfilter     7. 87.100 /  7. 87.100
>   libswscale      5.  8.100 /  5.  8.100
>   libswresample   3.  8.100 /  3.  8.100
>   libpostproc    55.  8.100 / 55.  8.100
> Guessed Channel Layout for Input Stream #0.0 : mono
> Input #0, wav, from '1.wav':
>   Duration: 00:26:39.00, bitrate: 256 kb/s
>     Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono,
> s16, 256 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (pcm_s16le (native) -> mp3 (libmp3lame))
> Press [q] to stop, [?] for help
> Output #0, mp3, to '1_default.mp3':
>   Metadata:
>     TSSE            : Lavf58.51.101
>     Stream #0:0: Audio: mp3 (libmp3lame), 16000 Hz, mono, s16p
>     Metadata:
>       encoder         : Lavc58.101.100 libmp3lame
> size=    4685kB time=00:26:39.01 bitrate=  24.0kbits/s speed= 426x
> video:0kB audio:4685kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 0.004690%
>
>
> =========================================================================================================
> 96k converting test
>
> =========================================================================================================
>
> ffmpeg.exe -i 1.wav -b:a 96k 1_96k.mp3
> ffmpeg version git-2020-08-28-ccc7120 Copyright (c) 2000-2020 the FFmpeg
> developers
>   built with gcc 10.2.1 (GCC) 20200805
>   configuration: --enable-gpl --enable-version3 --enable-sdl2
> --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
> --enable-libdav1d --enable-libbluray --enable-libfreetype
> --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
> --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy
> --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame
> --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
> --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma
> --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf
> --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa
> --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm
> --enable-librav1e --enable-libsvtav1 --disable-w32threads --enable-libmfx
> --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va
> --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
> --enable-libopenmpt --enable-amf
>   libavutil      56. 58.100 / 56. 58.100
>   libavcodec     58.101.100 / 58.101.100
>   libavformat    58. 51.101 / 58. 51.101
>   libavdevice    58. 11.101 / 58. 11.101
>   libavfilter     7. 87.100 /  7. 87.100
>   libswscale      5.  8.100 /  5.  8.100
>   libswresample   3.  8.100 /  3.  8.100
>   libpostproc    55.  8.100 / 55.  8.100
> Guessed Channel Layout for Input Stream #0.0 : mono
> Input #0, wav, from '1.wav':
>   Duration: 00:26:39.00, bitrate: 256 kb/s
>     Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono,
> s16, 256 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (pcm_s16le (native) -> mp3 (libmp3lame))
> Press [q] to stop, [?] for help
> Output #0, mp3, to '1_96k.mp3':
>   Metadata:
>     TSSE            : Lavf58.51.101
>     Stream #0:0: Audio: mp3 (libmp3lame), 16000 Hz, mono, s16p, 96 kb/s
>     Metadata:
>       encoder         : Lavc58.101.100 libmp3lame
> size=   18740kB time=00:26:39.01 bitrate=  96.0kbits/s speed= 397x
> video:0kB audio:18739kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 0.002486%
>
>
> 2020년 9월 2일 (수) 오전 8:08, Edward Park <kumowoon1025 at gmail.com>님이 작성:
>
>> Hi,
>>
>> > When converting a wav file to MP3 using the default option, an error
>> occurs
>> > in the length.
>> > Converted using the following command
>> >
>> > ffmpeg.exe -i 1.wav 1.mp3
>> >
>> > The duration of the original wav is 1:09:30, but the length of the
>> > converted MP3 is 1:07:16.
>> > The length of the file was checked through Windows Explorer and Windows
>> > Media Player.
>> > However, when checking with ocen audio and other software, it is
>> normally
>> > displayed as 1:09:30.
>>
>> That's more of a compromise than an error, encoder is most likely lame,
>> and in ffmpeg would use vbr by default with a command like that. So to get
>> accurate duration you pretty much need to decode, and it appears windows
>> media player estimates instead. If there is a difference when you playback
>> with a stopwatch in one hand that would be strange.
>>
>> > When I tested using the -b:a option, 64k and 96k are converted to the
>> same
>> > length, but there is a problem with 32k and 48k.
>> >
>> > ffmpeg.exe -i sample_2.wav -b:a 96k sample_2_96.mp3
>> >
>> > In addition, when converting m4a files to MP3, a problem occurs also in
>> 96k.
>> > Please help me on what to fix or give options.
>>
>> I think setting the bitrate makes it encode at cbr and that makes it
>> possible to determine the duration more accurately but not sure why
>> different bitrates gives different results.
>>
>> Actually how confident are you about the accuracy of the input file
>> duration that you are making these comparisons to?
>>
>> Regards,
>> Ted Park
>>
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
>


More information about the ffmpeg-user mailing list