[FFmpeg-user] trimmed audio has wrong duration

Carl Eugen Hoyos ceffmpeg at gmail.com
Sat Oct 5 14:22:30 EEST 2019


Am Sa., 5. Okt. 2019 um 12:49 Uhr schrieb Felix Muster via ffmpeg-user
<ffmpeg-user at ffmpeg.org>:

> I'm trying to trim 1.001 seconds from the beginning of a FLAC file.
> But the output has the wrong duration (same as the input) and so it's
> corrupt.
> When I try to open it with Adobe Audition I get an error (cannot read file).
>
> General
> Complete name                            : C:\_audio.flac
> Format                                   : FLAC
> Format/Info                              : Free Lossless Audio Codec
> File size                                : 759 MiB
> Duration                                 : 1 h 31 min
> Overall bit rate mode                    : Variable
> Overall bit rate                         : 1 160 kb/s
> Track name                               : MILLENIUM_D1_VERBLENDUNG.Title0
> Writing application                      : Lavf58.20.100
>
> Audio
> Format                                   : FLAC
> Format/Info                              : Free Lossless Audio Codec
> Duration                                 : 1 h 31 min
> Bit rate mode                            : Variable
> Bit rate                                 : 1 160 kb/s
> Channel(s)                               : 6 channels
> Channel layout                           : L R C LFE Ls Rs
> Sampling rate                            : 48.0 kHz
> Bit depth                                : 16 bits
> Compression mode                         : Lossless
> Stream size                              : 759 MiB (100%)
> Writing library                          : Lavf58.20.100

I don't remember an FFmpeg issue where this output was useful.

> _ffprobe.exe -v 0 -sexagesimal -show_entries format^=duration -of
> compact^=p^=0^:nk^=1 _audio.flac
> 1:31:29.848938
>
>
> 5489.848938 - 1.001 = 5488.847938
>
>
> _ffmpeg.exe -ss 1.001 -i _audio.flac -t 5488.847938 -codec copy
> _audio_1.flac
> ffmpeg version N-95216-ge6625ca41f Copyright (c) 2000-2019 the FFmpeg
> developers
>   built with gcc 9.2.1 (GCC) 20190918
>   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-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-libvorbis --enable-libvo-amrwbenc
> --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom
> --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va
> --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
> --enable-libopenmpt --enable-amf
>   libavutil      56. 35.100 / 56. 35.100
>   libavcodec     58. 59.101 / 58. 59.101
>   libavformat    58. 33.100 / 58. 33.100
>   libavdevice    58.  9.100 / 58.  9.100
>   libavfilter     7. 61.100 /  7. 61.100
>   libswscale      5.  6.100 /  5.  6.100
>   libswresample   3.  6.100 /  3.  6.100
>   libpostproc    55.  6.100 / 55.  6.100
> Input #0, flac, from '_audio.flac':
>   Metadata:
>     TITLE           : MILLENIUM_D1_VERBLENDUNG.Title0
>     encoder         : Lavf58.20.100
>   Duration: 01:31:29.85, start: 0.000000, bitrate: 1159 kb/s
>     Stream #0:0: Audio: flac, 48000 Hz, 5.1(side), s16
> Output #0, flac, to '_audio_1.flac':
>   Metadata:
>     TITLE           : MILLENIUM_D1_VERBLENDUNG.Title0
>     encoder         : Lavf58.33.100
>     Stream #0:0: Audio: flac, 48000 Hz, 5.1(side), s16
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
> Press [q] to stop, [?] for help
> video:0kB audio:777322kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 0.001046%

While it is not generally possible to cut flac like this (you can instead do the
cutting when creating the first flac file or you can re-encode), feel free to
provide the input sample (I guess the issue should be reproducible with a
cut file).

Carl Eugen


More information about the ffmpeg-user mailing list