Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#8569 closed defect (duplicate)

Trimming a FLAC file does not cut trim the duration

Reported by: Trevor Hinesley Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I am trying to trim/shorten a FLAC file, but when using -t or -fs to do so, the file's duration does not change, it is just filled with silence after the specified stopping point.

How to reproduce:
Using -t:

% ffmpeg -y -i /Users/trevorhinesley/Downloads/Sample_BeeMoved_96kHz24bit.flac -c copy -ss 0 -t 00:00:10 test10seconds.flac

or-fs:

% ffmpeg -y -i /Users/trevorhinesley/Downloads/Sample_BeeMoved_96kHz24bit.flac -c copy -ss 0 -fs 512000 test10seconds.flac

Report:

ffmpeg started on 2020-03-13 at 11:45:31
Report written to "ffmpeg-20200313-114531.log"
Command line:
ffmpeg -y -i /Users/me/Downloads/Sample_BeeMoved_96kHz24bit.flac -c copy -ss 0 -t 00:00:10 test10seconds.flac -report
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-i' ... matched as input url with argument '/Users/me/Downloads/Sample_BeeMoved_96kHz24bit.flac'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '0'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '00:00:10'.
Reading option 'test10seconds.flac' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url /Users/me/Downloads/Sample_BeeMoved_96kHz24bit.flac.
Successfully parsed a group of options.
Opening an input file: /Users/me/Downloads/Sample_BeeMoved_96kHz24bit.flac.
[NULL @ 0x7fef88001a00] Opening '/Users/me/Downloads/Sample_BeeMoved_96kHz24bit.flac' for reading
[file @ 0x7fef7f806980] Setting default whitelist 'file,crypto'
[flac @ 0x7fef88001a00] Format flac probed with size=2048 and score=100
[flac @ 0x7fef88001a00] Before avformat_find_stream_info() pos: 60099 bytes read:65536 seeks:0 nb_streams:2
[mjpeg @ 0x7fef4f000600] marker=d8 avail_size_in_buf=58334
[mjpeg @ 0x7fef4f000600] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x7fef4f000600] marker=e0 avail_size_in_buf=58332
[mjpeg @ 0x7fef4f000600] marker parser used 16 bytes (128 bits)
[mjpeg @ 0x7fef4f000600] marker=db avail_size_in_buf=58314
[mjpeg @ 0x7fef4f000600] index=0
[mjpeg @ 0x7fef4f000600] qscale[0]: 3
[mjpeg @ 0x7fef4f000600] index=1
[mjpeg @ 0x7fef4f000600] qscale[1]: 6
[mjpeg @ 0x7fef4f000600] marker parser used 132 bytes (1056 bits)
[mjpeg @ 0x7fef4f000600] marker=c0 avail_size_in_buf=58180
[mjpeg @ 0x7fef4f000600] Changing bps from 0 to 8
[mjpeg @ 0x7fef4f000600] sof0: picture: 500x500
[mjpeg @ 0x7fef4f000600] component 0 2:2 id: 0 quant:0
[mjpeg @ 0x7fef4f000600] component 1 1:1 id: 1 quant:1
[mjpeg @ 0x7fef4f000600] component 2 1:1 id: 2 quant:1
[mjpeg @ 0x7fef4f000600] pix fmt id 22111100
[mjpeg @ 0x7fef4f000600] Format yuvj420p chosen by get_format().
[mjpeg @ 0x7fef4f000600] marker parser used 17 bytes (136 bits)
[mjpeg @ 0x7fef4f000600] marker=c4 avail_size_in_buf=58161
[mjpeg @ 0x7fef4f000600] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x7fef4f000600] escaping removed 102 bytes
[mjpeg @ 0x7fef4f000600] marker=da avail_size_in_buf=57741
[mjpeg @ 0x7fef4f000600] marker parser used 57639 bytes (461112 bits)
[mjpeg @ 0x7fef4f000600] marker=d9 avail_size_in_buf=0
[mjpeg @ 0x7fef4f000600] decode frame unused 0 bytes
[flac @ 0x7fef88001a00] All info found
[flac @ 0x7fef88001a00] After avformat_find_stream_info() pos: 100352 bytes read:131072 seeks:0 frames:2
Input #0, flac, from '/Users/me/Downloads/Sample_BeeMoved_96kHz24bit.flac':
  Metadata:
    ALBUM           : Bee Moved
    TITLE           : Bee Moved
    album_artist    : Blue Monday FM
    MRAT            : 0
    ARTIST          : Blue Monday FM
  Duration: 00:00:39.88, start: 0.000000, bitrate: 3340 kb/s
    Stream #0:0, 1, 1/96000: Audio: flac, 96000 Hz, stereo, s32 (24 bit)
    Stream #0:1, 1, 1/90000: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 500x500 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      comment         : Cover (front)
      title           : image/jpeg
Successfully opened the file.
Parsing a group of options: output url test10seconds.flac.
Applying option c (codec name) with argument copy.
Applying option ss (set the start time offset) with argument 0.
Applying option t (record or transcode "duration" seconds of audio/video) with argument 00:00:10.
Successfully parsed a group of options.
Opening an output file: test10seconds.flac.
[file @ 0x7fef7f9173c0] Setting default whitelist 'file,crypto'
Successfully opened the file.
Output #0, flac, to 'test10seconds.flac':
  Metadata:
    ALBUM           : Bee Moved
    TITLE           : Bee Moved
    album_artist    : Blue Monday FM
    MRAT            : 0
    ARTIST          : Blue Monday FM
    encoder         : Lavf58.29.100
    Stream #0:0, 0, 1/90000: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 500x500 [SAR 1:1 DAR 1:1], q=2-31, 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      comment         : Cover (front)
      title           : image/jpeg
    Stream #0:1, 0, 1/96000: Audio: flac, 96000 Hz, stereo, s32 (24 bit)
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[flac @ 0x7fef88001a00] first_dts 0 not matching first dts 3817728 (pts 3817728, duration 1152) in the queue
No more output streams to write to, finishing.
frame=    1 fps=0.0 q=-1.0 Lsize=    4265kB time=00:00:09.99 bitrate=3495.0kbits/s speed= 249x    
video:57kB audio:4199kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.193804%
Input file #0 (/Users/me/Downloads/Sample_BeeMoved_96kHz24bit.flac):
  Input stream #0:0 (audio): 3323 packets read (16592678 bytes); 
  Input stream #0:1 (video): 1 packets read (58336 bytes); 
  Total: 3324 packets (16651014 bytes) demuxed
Output file #0 (test10seconds.flac):
  Output stream #0:0 (video): 1 packets muxed (58336 bytes); 
  Output stream #0:1 (audio): 834 packets muxed (4300193 bytes); 
  Total: 835 packets (4358529 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x7fef7f807540] Statistics: 2 seeks, 18 writeouts
[AVIOContext @ 0x7fef7f806b80] Statistics: 16652777 bytes read, 0 seeks

Or:

Change History (3)

comment:1 by Trevor Hinesley, 5 years ago

Apologies, I meant to remove my name from the /Users/<name> piece of my commands, if a mod wouldn't mind doing that :) also didn't mean to have the Or: at the end.

comment:2 by Carl Eugen Hoyos, 5 years ago

Component: ffmpegundetermined
Keywords: flac removed
Resolution: duplicate
Status: newclosed

Duplicate of ticket #4905.

comment:3 by Trevor Hinesley, 5 years ago

Sorry about that, I genuinely ran a search but must've missed it.

Note: See TracTickets for help on using tickets.