svt / encore

Transcode media files in an epic manner
European Union Public License 1.2
273 stars 25 forks source link

How to implement filters? #18

Closed jd7352 closed 2 years ago

jd7352 commented 2 years ago

This is a great project and I have successfully experienced its power. Now I want to implement watermark or logo while transcoding, how can I pass parameters such as overlay coordinates, logo's url through program.yml ? Please give pointers, thanks!

jd7352 commented 2 years ago

I can successfully execute the following commands in the ~/ffmpeg_encore/ directory: ffmpeg -i input.mp4 -vf "movie=logo.jpg[logo];[0:v][logo]overlay" output.mp4 ffmpeg -i input.mp4 -filter_complex "movie=logo.png[logo];[0:v][logo]overlay" output.mp4

But entering the configuration through program.yml always returns an error. The configuration file is as follows:

`name: program description: my profile scaling: bicubic encodes:

grusell commented 2 years ago

filter_complex is not valid in encore encoding profiles, the correct keyword is filters. Also because of how the filter chain is put together by encore, in this case you will need to use a null filter to save the video input. You will also need to include the full path to your logo. So In your profile, you could use something like

    filters: ["null[my-filter-in];movie=/full/path/to/logo/logo.jpg[logo];[my-filter-in][logo]overlay"]

Also, instead of specifying the ss and t parameters in the profile you could set seekTo and duration on the job you post in.

jd7352 commented 2 years ago

filter_complex is not valid in encore encoding profiles, the correct keyword is filters. Also because of how the filter chain is put together by encore, in this case you will need to use a null filter to save the video input. You will also need to include the full path to your logo. So In your profile, you could use something like

    filters: ["null[my-filter-in];movie=/full/path/to/logo/logo.jpg[logo];[my-filter-in][logo]overlay"]

Also, instead of specifying the ss and t parameters in the profile you could set seekTo and duration on the job you post in.

marvelous! Following your method got the results I was hoping for, thanks a lot! In addition, the use of ss and t parameters in the configuration file is because I need to generate a 10-second video preview in a single transcoding task at the same time, my configuration should be correct (currently it works, I am in Simplified the configuration file behind when submitting an issue)?

grusell commented 2 years ago

Glad to hear your problem is solved!

Oh I see, with that use case it makes sense to use ss and t the parameters like that.