Opened 13 months ago

Closed 8 months ago

Last modified 8 months ago

#10287 closed defect (invalid)

Trimming .FLAC files the duration doesn't get updated and remains as the input original

Reported by: 456325 Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: flac
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I am trying to cut out part of the flac audio file and the resulting file has full length of the original (wrong), though the file size is lower than original (good). Seeking in media player (for example MPV or VLC) beyond what was cut cause reset of the playback to beginning.

Input file: https://drive.proton.me/urls/HZ2J3EWZNG#8KQk7SA6sLfN

Command used to cut it:

$ ffmpeg -hide_banner -ss '111.17848' -i 'input.flac' -t '369.79157' -avoid_negative_ts make_zero -map '0:0' '-c:0' copy -map_metadata 0 -movflags '+faststart' -default_mode infer_no_subs -ignore_unknown -f flac -y 'output.flac'

$ ./ffmpeg -v 9 -loglevel 99 -i 'input.flac'

ffmpeg version N-65014-g7c130d6911-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  6.101 / 60.  6.101
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input url with argument 'input.flac'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url input.flac.
Successfully parsed a group of options.
Opening an input file: input.flac.
[NULL @ 0x7819ac0] Opening 'input.flac' for reading
[file @ 0x781a2c0] Setting default whitelist 'file,crypto,data'
Probing flac score:100 size:2048
[flac @ 0x7819ac0] Format flac probed with size=2048 and score=100
[flac @ 0x7819ac0] Before avformat_find_stream_info() pos: 9509 bytes read:32768 seeks:0 nb_streams:1
[flac @ 0x781ac80] sample/frame number mismatch in adjacent frames
    Last message repeated 20 times
[flac @ 0x7819ac0] All info found
[flac @ 0x7819ac0] stream 0: start_time: 0 duration: 561.75
[flac @ 0x7819ac0] format: start_time: 0 duration: 561.75 (estimate from stream) bitrate=935 kb/s
[flac @ 0x7819ac0] After avformat_find_stream_info() pos: 60416 bytes read:65536 seeks:0 frames:1
Input #0, flac, from 'input.flac':
  Metadata:
    TITLE           : redacted
    ARTIST          : redacted
    ALBUM ARTIST    : redacted
    album_artist    : redacted
    ALBUM           : redacted
    track           : redacted
    PERFORMER       : redacted
    COMMENT         : redacted
    GENRE           : redacted
    DATE            : redacted
    COMPOSER        : redacted
    ENSEMBLE        : redacted
    RATING          : redacted
    TOTALTRACKS     : redacted
  Duration: 00:09:21.75, start: 0.000000, bitrate: 935 kb/s
  Stream #0:0, 1, 1/44100: Audio: flac, 44100 Hz, stereo, s16
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 0x7822700] Statistics: 65536 bytes read, 0 seeks

Change History (5)

comment:1 by Balling, 8 months ago

That is not a bug. -c copy cannot update the duration. It would not be a copy then, now would it.

comment:2 by Balling, 8 months ago

Keywords: FLAC removed

comment:3 by Elon Musk, 8 months ago

Resolution: invalid
Status: newclosed

-copy will also copy stream duration because its raw flac and not some higher level container/format.

in reply to:  3 comment:4 by 456325, 8 months ago

Replying to Elon Musk:

-copy will also copy stream duration

Replying to Balling:

-c copy cannot update the duration

Please kindly what is the way/ffmpeg parameters to change the stream duration when outputting the flac? Thank you in advance.

comment:5 by Balling, 8 months ago

Reencode.

Note: See TracTickets for help on using tickets.