[FFmpeg-devel] Working on an LTC source filter - can this be made seekable?

Johannes Maibaum jmaibaum at gmail.com
Thu Aug 31 22:35:18 EEST 2023


Hello,

as my first dive into the ffmpeg source, I am working on an 
Linear/Longitudinal Time Code (LTC) source filter for ffmpeg using 
https://github.com/x42/libltc here:

https://git.sr.ht/~jmaibaum/ffmpeg/log/ltc

The basics are working fine and turned out to be fairly easy to achieve, 
even though I am still missing essential features, major refactorings, 
and proper testing, before I would consider it ready for inclusion into 
ffmpeg. I am planning to get there eventually once my free time allows.

Yet, I am now facing an issue where I am unsure if the plan to add the 
ltcsrc as a libav source filter was correct in the first place?

One of the use-cases I have in mind for the ltcsrc filter involves 
having it generate an LTC signal while playing another audio or video 
file in sync, i.e. the LTC signal should of course always match the 
current position of the audio/video file's playback position. It should 
be possible to seek arbitrarily inside the video player, thus. the LTC 
timecode being generated after a seek event signal must always stay in 
sync to the new playback position of the audio/video file.

But apparently libav-filters are by design not supporting seek events at 
all though, at least not from ffplay, where running

ffplay -f lavfi -i ltcsrc

and then trying to seek results in "error while seeking". This error 
also happens with all other filters I tried using in the ffplay command 
line above. Similar quick checks trying to use the filter from within 
mpv resulted in an unseekable playback.

I can successfully send commands (via asendcmd) to change the timecode 
being generated on the fly, but this feels like a bad workaround for the 
use-case described above.

I took a brief look into other ffmpeg modules (codecs, formats, 
devices), but from my current understanding a (source) filter is the 
correct way to implement ltcsrc.

Thus, my question is: Can this use-case even be solved by implementing 
ltcsrc as a filter? If not, how can I implement an ltcsrc that can be 
used "like" a filter (i.e. supporting things like receiving commands to 
change other parameters on the fly) in my use-case, but also supporting 
seek events?


Cheers,
Johannes


More information about the ffmpeg-devel mailing list