Opened 2 months ago

Last modified 5 weeks ago

#11278 new enhancement

Custom playback routines definition

Reported by: Danny Weijermans Owned by:
Priority: normal Component: ffmpeg
Version: unspecified Keywords: audio wav loop
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

hopefully it's okay to ask for a feature this way:
ffmpeg plays audio greatly.
the wav audio format implements loop definition, loop start and loop end (in samples.)
it would be great if ffmpeg allowed for playing this:
play until the loop end, then restart from the loop start, without glitching, sample-accurate.
A good explanation of the wav definition is here:
https://web.archive.org/web/20141226210234/http://www.sonicspot.com/guide/wavefiles.html#smpl

Change History (7)

comment:1 by Danny Weijermans, 8 weeks ago

PS, I can help in code to 'get' the wav soundfile looppoints in samples:

I've done this in another (Mac-) project

comment:2 by MasterQuestionable, 8 weeks ago

Cc: MasterQuestionable added
Summary: ffmpeg audio feature requestCustom playback routines definition

͏    What if it became infinite loop..?
͏    Playback related, probably you mean FFplay instead?

͏    Whatsoever I think it might be beyond WAV and mere audio:
͏    https://github.com/MasterInQuestion/talk/discussions/3#discussioncomment-9376594

comment:3 by Danny Weijermans, 8 weeks ago

I use ffmpeg to play the soundfiles (excellent! all formats, also hi-res)
but maybe ffplay does a great job too.
The wav riff format implements loop-on/off, loop-start and loop-end to play seamless loops,

and gets mostly used in 'samplers' (both hardware and software).

Of course one would end the playing at a certain time, because looping can be endless..
It would be great to have the option in ffmpeg or ffplay..

comment:4 by Danny Weijermans, 8 weeks ago

maybe use the ffmpeg audiofilter 'aloop' for this inside the playback code?
it does already part of the job..
a flag to set for playback of the 'smpl'chunk loop..

comment:5 by MasterQuestionable, 8 weeks ago

͏    FFmpeg only converts: no really playback unless bundled into other applications.

͏    For your WAV case specifically: it's essentially interpreting the relevant metadata and make use of which. [ #11301 ]
͏    Not sure every part of the current spec perfectly makes sense.
͏    As workaround: you may write the interpreted values into filters.

͏    However, note currently the seeking things in FF-* may not perfectly work:
͏    https://trac.ffmpeg.org/ticket/11060
͏    https://trac.ffmpeg.org/ticket/11217#comment:9

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

comment:6 by Danny Weijermans, 5 weeks ago

Dear MasterQuestionable,
Thanks a lot for your answers!
When I want to work on a workaround:

how would I interpret values into filters?

Is it possible to setup filters,

in order to playback a looped section?

Do you mean, first rendering a new audiofile including the loops (couple of times)

then playing that instead of the original file?

Regards! Danny Weijermans

comment:7 by MasterQuestionable, 5 weeks ago

͏    Depends on your needs.
͏    FFplay may directly handle filter-chains runtime.
͏    [ E.g. https://trac.ffmpeg.org/wiki/DenoiseExamples#Testing ]
͏    So the pre-rendered files may not be necessary.

͏    As for how exactly, somewhat implementation dependent.
͏    Generally, just write that interpreted from the metadata into the filter.
͏    Alike: https://trac.ffmpeg.org/ticket/11283#comment:1

Note: See TracTickets for help on using tickets.