Problem about duration value of converted mp3 file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem about duration value of converted mp3 file

myounggun jang
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.
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.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem about duration value of converted mp3 file

Carl Zwanzig
On 9/1/2020 1:21 AM, myounggun jang wrote:
> The duration of the original wav is 1:09:30, but the length of the
> converted MP3 is 1:07:16.

Are those durations from actually playing the file? It's not uncommon for
the container's metadata to be wrong and it sounds as if that's what's wrong
(when different tools show different info, it's usually a metadata problem).

Please verify that the output file actually has 1:09:30 of content.

And what are you trying to accomplish? Just re-encoding the files or
something else?

z!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem about duration value of converted mp3 file

Carl Eugen Hoyos-2
In reply to this post by myounggun jang
Am Di., 1. Sept. 2020 um 10:22 Uhr schrieb myounggun jang <[hidden email]>:

> ffmpeg.exe -i 1.wav 1.mp3

Complete, uncut console output missing.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem about duration value of converted mp3 file

kumowoon1025
In reply to this post by myounggun jang
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
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem about duration value of converted mp3 file

myounggun jang
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 <[hidden email]>님이 작성:

> 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
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem about duration value of converted mp3 file

myounggun jang
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 <[hidden email]>님이 작성:

> 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 <[hidden email]>님이 작성:
>
>> 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
>> [hidden email]
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> [hidden email] with subject "unsubscribe".
>
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem about duration value of converted mp3 file

kumowoon1025
Hi,

> 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.

>> 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.

Okay, so the file displays 25:47 in Media Player and plays... how long? Have you tried actually timing it, perhaps with a stopwatch like on your phone? I mean that is like a ~40 second difference if the number displayed is accurate I think you would be reporting some other issue, like being truncated, or sped up, skipping, etc.

Regards,
Ted Park

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem about duration value of converted mp3 file

Carl Zwanzig
On 9/13/2020 11:47 PM, Edward Park wrote:
> Okay, so the file displays 25:47 in Media Player and plays... how long?

Yep, and I also asked that almost two weeks ago.

The only sure ways to know the actual Total Running Time (TRT) are either to
render it in real time or to count the frames/samples and calculate based on
the frame/sample rate (which only works on fixed/constant frame rates and
even that can be suspect). (Well, maybe by looking at the PTSs.) Most tools
will only tell you the TRT/duration that was saved in metadata and that's
often untrustworthy; this sounds like one of those cases.


To the original poster- please do not "top post" on this mailing list.

z!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".