1
0
Fork
You've already forked video_export_processing
0

Overlay the image generated in processing about another image #62

Open
opened 2020年11月20日 18:10:52 +01:00 by dancodedev · 8 comments
dancodedev commented 2020年11月20日 18:10:52 +01:00 (Migrated from github.com)
Copy link

I'm trying to put a default background image and overlay the image generated by processing, but I can't get it.

This is the normal configuration, it works correctly

videoExport.setFfmpegVideoSettings(
 new String[]{
 "[ffmpeg]",
 "-y",
 "-f", "rawvideo",
 "-vcodec", "rawvideo",
 "-s", "[width]x[height]",
 "-pix_fmt", "rgb24",
 "-r", "[fps]",
 "-i", "pipe:0",
 "-an",
 "-vcodec", "h264",
 "-pix_fmt", "yuv420p",
 "-crf", "[crf]",
 "-preset", "ultrafast",
 "[output]"
 });

With this code I can do what I want. But I don't know how to use it with pipe

ffmpeg -loop 1 -framerate 1 -i 4k.jpg -framerate 30 -i 1k.jpg -filter_complex "overlay=0:0:shortest=1,format=yuv420p" -c:v libx264 -r 30 -movflags +faststart output.mp4

I hope someone can help me. Thank you

The green image would be the processed image in processing, the one coming by pipe and the background image would be a static image configured in the ffmpeg output
image

I'm trying to put a default background image and overlay the image generated by processing, but I can't get it. This is the normal configuration, it works correctly ``` videoExport.setFfmpegVideoSettings( new String[]{ "[ffmpeg]", "-y", "-f", "rawvideo", "-vcodec", "rawvideo", "-s", "[width]x[height]", "-pix_fmt", "rgb24", "-r", "[fps]", "-i", "pipe:0", "-an", "-vcodec", "h264", "-pix_fmt", "yuv420p", "-crf", "[crf]", "-preset", "ultrafast", "[output]" }); ``` With this code I can do what I want. But I don't know how to use it with pipe ``` ffmpeg -loop 1 -framerate 1 -i 4k.jpg -framerate 30 -i 1k.jpg -filter_complex "overlay=0:0:shortest=1,format=yuv420p" -c:v libx264 -r 30 -movflags +faststart output.mp4 ``` I hope someone can help me. Thank you The green image would be the processed image in processing, the one coming by pipe and the background image would be a static image configured in the ffmpeg output ![image](https://user-images.githubusercontent.com/45150122/99829146-34567900-2b5c-11eb-95e0-5d2a7b9e5f5a.png)
hamoid commented 2020年11月20日 19:30:20 +01:00 (Migrated from github.com)
Copy link

Hi, why not load the image into Processing then for every frame draw the background image and all the elements it needs?

Or in other words, is there any advantage to twisting the command to do what would be quite easy with Processing?

Hi, why not load the image into Processing then for every frame draw the background image and all the elements it needs? Or in other words, is there any advantage to twisting the command to do what would be quite easy with Processing?
dancodedev commented 2020年11月21日 13:21:32 +01:00 (Migrated from github.com)
Copy link

Hola, ¿por qué no cargar la imagen en Procesamiento y luego para cada fotograma dibujar la imagen de fondo y todos los elementos que necesita?

O en otras palabras, ¿hay alguna ventaja para torcer el comando para hacer lo que sería bastante fácil con el procesamiento?

Yes, I am rendering videos of a duration of hours, if I modify the output of the ffmpeg I can have a greater number of frames in processing because the window has a smaller resolution, the gain in speed is very good.

image

> Hola, ¿por qué no cargar la imagen en Procesamiento y luego para cada fotograma dibujar la imagen de fondo y todos los elementos que necesita? > > O en otras palabras, ¿hay alguna ventaja para torcer el comando para hacer lo que sería bastante fácil con el procesamiento? Yes, I am rendering videos of a duration of hours, if I modify the output of the ffmpeg I can have a greater number of frames in processing because the window has a smaller resolution, the gain in speed is very good. ![image](https://user-images.githubusercontent.com/45150122/99877277-2147b580-2bfd-11eb-85d3-173588605716.png)
hamoid commented 2020年11月21日 15:45:00 +01:00 (Migrated from github.com)
Copy link

I see. It's probably doable but I have no time at the moment to find the right command. I hope someone knows :)

I see. It's probably doable but I have no time at the moment to find the right command. I hope someone knows :)
dancodedev commented 2020年11月21日 18:19:57 +01:00 (Migrated from github.com)
Copy link

Thanks for your answer, I'll keep researching for that.

Thanks for your answer, I'll keep researching for that.
bcoley commented 2020年11月24日 21:15:27 +01:00 (Migrated from github.com)
Copy link

I've never tried anything like that, but I can see where it would be useful, a quick google turns up this article that describes what you are trying to do, if I understand you correctly https://video.stackexchange.com/questions/16975/how-do-i-put-the-image-behind-video-by-using-ffmpeg

I've never tried anything like that, but I can see where it would be useful, a quick google turns up this article that describes what you are trying to do, if I understand you correctly https://video.stackexchange.com/questions/16975/how-do-i-put-the-image-behind-video-by-using-ffmpeg
hamoid commented 2020年11月24日 21:21:33 +01:00 (Migrated from github.com)
Copy link

That's what he's trying to do, but not only. The difference is that on top of that, the video in question does not yet exist but it's being created frame by frame. Maybe someone with experience in juggling ffmpeg commands can suggest a solution :)

That's what he's trying to do, but not only. The difference is that on top of that, the video in question does not yet exist but it's being created frame by frame. Maybe someone with experience in juggling ffmpeg commands can suggest a solution :)
bcoley commented 2020年11月24日 21:42:26 +01:00 (Migrated from github.com)
Copy link

Right, I thought they could render the video from processing, then add the background image afterwards using the ffmpeg command in the article there under "overlay filter". The example in the article is adding a background to the sides of the video, which the W-w/2 part seems to be handling, I imagine a complete border around the video is possible as well, just a matter of experimenting at the cmd line. Or am I misunderstanding what they intend for the final result?

ffmpeg -loop 1 -i image.png -i video.mp4 -filter_complex "overlay=(W-w)/2:shortest=1" output.mp4

Right, I thought they could render the video from processing, then add the background image afterwards using the ffmpeg command in the article there under "overlay filter". The example in the article is adding a background to the sides of the video, which the W-w/2 part seems to be handling, I imagine a complete border around the video is possible as well, just a matter of experimenting at the cmd line. Or am I misunderstanding what they intend for the final result? ffmpeg -loop 1 -i image.png -i video.mp4 -filter_complex "overlay=(W-w)/2:shortest=1" output.mp4
hamoid commented 2020年11月24日 21:48:59 +01:00 (Migrated from github.com)
Copy link

A possible issue with doing it in two steps is that it would be compressed twice, loosing quality. But if the first pass uses a lossless video format then it should be ok I think.

A possible issue with doing it in two steps is that it would be compressed twice, loosing quality. But if the first pass uses a lossless video format then it should be ok I think.
Sign in to join this conversation.
No Branch/Tag specified
master
kotlinGradle
v23
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hamoid/video_export_processing#62
Reference in a new issue
hamoid/video_export_processing
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?