Read values from a text or CSV file?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Read values from a text or CSV file?

Michael Koch
Hello all,

for a special effect I want to overlay a small video over the main
video, where the position of the overlay is a function of time. It's a
complicated function and can't be expressed by a simple formula.
Segment-wise linear interpolation might work, but many segments are
required and the command line may get too long:

between(t,0,1) * lerp(x0,x1,t) +
between(t,1,2) * lerp(x1,x2,t-1) +
between(t,2,3) * lerp(x2,x1,t-2) + ...

Is there any way to read the pre-calculated coordinates for the overlay
filter from a text or CSV file? Or from a PGM file, as in the remap filter?

Thanks,
Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Read values from a text or CSV file?

Gyan


On 02-09-2019 12:05 PM, Michael Koch wrote:

> Hello all,
>
> for a special effect I want to overlay a small video over the main
> video, where the position of the overlay is a function of time. It's a
> complicated function and can't be expressed by a simple formula.
> Segment-wise linear interpolation might work, but many segments are
> required and the command line may get too long:
>
> between(t,0,1) * lerp(x0,x1,t) +
> between(t,1,2) * lerp(x1,x2,t-1) +
> between(t,2,3) * lerp(x2,x1,t-2) + ...
>
> Is there any way to read the pre-calculated coordinates for the
> overlay filter from a text or CSV file? Or from a PGM file, as in the
> remap filter?

You can just read the whole filtergraph from a file.

     ffmpeg -i in -filter_complex_script graph.txt ...

where graph.txt is

e.g.

     [0:v][2:v]overlay=...[out]


Gyan
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Read values from a text or CSV file?

Michael Koch
Hello Gyan,

> You can just read the whole filtergraph from a file.
>
>     ffmpeg -i in -filter_complex_script graph.txt ...
>
> where graph.txt is
>
> e.g.
>
>     [0:v][2:v]overlay=...[out]
>

That's a good idea!
Are line feeds allowed in the text file, or must all be written in one line?

Michael
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Read values from a text or CSV file?

Paul B Mahol
On 9/2/19, Michael Koch <[hidden email]> wrote:

> Hello Gyan,
>
>> You can just read the whole filtergraph from a file.
>>
>>     ffmpeg -i in -filter_complex_script graph.txt ...
>>
>> where graph.txt is
>>
>> e.g.
>>
>>     [0:v][2:v]overlay=...[out]
>>
>
> That's a good idea!
> Are line feeds allowed in the text file, or must all be written in one line?

Try it?

>
> Michael
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Read values from a text or CSV file?

Michael Koch

>> That's a good idea!
>> Are line feeds allowed in the text file, or must all be written in one line?
> Try it?

It works with line feeds.

Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".