Opened 3 months ago

Last modified 6 weeks ago

#7155 reopened enhancement

Add option to stop writing at position relative to EOF

Reported by: clone206 Owned by:
Priority: wish Component: ffmpeg
Version: unspecified Keywords:
Cc: ffmpeg@gyani.pro Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Feature request
How to reproduce:
N/A

Add main option to allow stopping of writing to output at position relative to "end of file", where 0 is eof, and negative values are earlier in the file.

Proposed switch: "-toeof", like "-sseof" but for stopping point instead of beginning point.

Background: I have ripped SACD audio tracks with extraneous loud noises at the last few hundred milliseconds of each track, and want to chop off that duration from the end of each file as part of a batch process. I would like to do something like the following on each file:

ffmpeg -i input.flac -toeof -00:00:00.9 output.flac

Change History (14)

comment:1 in reply to: ↑ description Changed 3 months ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • Keywords seek removed
  • Priority changed from wish to normal
  • Resolution set to invalid
  • Status changed from new to closed
  • Type changed from enhancement to defect
  • Version changed from 3.4 to unspecified

Replying to clone206:
No new options can be requested for releases and I don't think this can be implemented.

Background: I have ripped SACD audio tracks with extraneous loud noises at the last few hundred milliseconds of each track, and want to chop off that duration from the end of each file as part of a batch process. I would like to do something like the following on each file:

Instead, please explain how we can reproduce (and fix) this bug.

comment:2 Changed 3 months ago by clone206

This is not a bug that needs fixing. It's a feature request. Are you saying you don't accept feature requests, or rather that because I chose a release number the feature request is invalid?

I'm quite certain it could be implemented, since you already basically did the same thing with the -sseof option.

comment:3 Changed 3 months ago by clone206

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:4 Changed 3 months ago by clone206

  • Type changed from defect to enhancement

comment:5 Changed 3 months ago by Gyan

  • Cc ffmpeg@gyani.pro added

comment:6 Changed 6 weeks ago by withmorten

Hi clone206,

I ran into a similar problem this week when I wanted to cut off one second of silence at the end of some files which I had added earlier (with ffmpeg).

It wasn't too hard to implement and can probably be improved on sanity check-wise, but it works for my purposes and can probably be used as a good starting point for properly implementing this by somebody who knows how ffmpeg is supposed to work:

https://gist.github.com/withmorten/ea585798076fa020b757437f23aca768

Diffed against ffmpeg 3.4.2.

It only works as input option (duration seemed to be unknown in open_output_file), so you'll have to use it like:

ffmpeg -toeof -00:00:00.9 -i input.flac output.flac

It basically makes the input file shorter by whatever amount you tell it.

Not entirely sure why this would be impossible to implement ...?

comment:7 Changed 6 weeks ago by clone206

Thanks, withmorten! That's basically exactly the way I would've done it. Might be worth forking the current github and making a pull request, though I don't know if Gyan is already working on it.

comment:8 Changed 6 weeks ago by Gyan

Generate a patch against git master and send it to the mailing list.

comment:9 Changed 6 weeks ago by withmorten

Should I modify the ffmpeg.texi file as well to include the new commandline switch?

Such as:

@item -toeof @var{position} (@emph{input})
Stop writing the output at @var{position} relative to the "end of file". That is negative
values are later in the file, 0 is at EOF.

Last edited 6 weeks ago by withmorten (previous) (diff)

comment:10 Changed 6 weeks ago by Gyan

Please do. Thanks.

comment:11 Changed 6 weeks ago by cehoyos

  • Component changed from undetermined to ffmpeg
  • Priority changed from normal to wish

I didn't consider -sseof working for any interpretation but if that is what you need, it may be possible.

Please do not forget to report the original bug, it would be nice to fix it.

comment:12 follow-up: Changed 6 weeks ago by clone206

cehoyos,

In what way is -sseof not working? For those of us interested in possibly contributing, it would be good to know, as I haven't had any issues with that option, which has been available for some time now.

Also, sorry if it wasn't clear, but I never reported a bug that needs fixing, but rather a feature request. If there is any documentation on how to properly make a feature request I would gladly familiarize myself with it.

comment:13 in reply to: ↑ 12 Changed 6 weeks ago by cehoyos

Replying to clone206:

Also, sorry if it wasn't clear, but I never reported a bug

This is not true, you just didn't explain how we can reproduce.

comment:14 Changed 6 weeks ago by clone206

Reproduce what?

Note: See TracTickets for help on using tickets.