1

I have 2 commands, one for overlay(work alone), one for add text (work alone), i want this 2 commands in one.

ffmpeg -i myvideo.mp4 -i image.png -filter_complex [0:v][1:v]overlay=5:5,drawtext=fontfile=:text=mytext:fontcolor=orange@1.0:fontsize=30:x=30:y=200[v] -map [output] output.mp4

This command generate empty file without error.

Cleoh
  • 25
  • 1
  • 5

1 Answers1

2

Your -map option is using a label that does not reference anything.

You should be getting this error:

Output with label 'output' does not exist in any defined filter graph, or was already used elsewhere.

The -filter_complex output and the -map option should use the same label. It can be almost any arbitrary name as long as they match. Also, your fontfile is missing the font path. You may have to quote your text string, but you're using Android and it is weird with quoting. Lastly, you should stream copy the audio.

Use this: both filter output and -map are using [v]

ffmpeg -i myvideo.mp4 -i image.png -filter_complex [0:v][1:v]overlay=5:5,drawtext=text=mytext:fontcolor=orange@1.0:fontsize=30:x=30:y=200[v] -map [v] -map 0:a -c:a copy output.mp4

or this: both filter output and -map are using [output]

ffmpeg -i myvideo.mp4 -i image.png -filter_complex [0:v][1:v]overlay=5:5,drawtext=text=mytext:fontcolor=orange@1.0:fontsize=30:x=30:y=200[output] -map [output] -map 0:a -c:a copy output.mp4

or this: use the default stream selection

ffmpeg -i myvideo.mp4 -i image.png -filter_complex [0:v][1:v]overlay=5:5,drawtext=text=mytext:fontcolor=orange@1.0:fontsize=30:x=30:y=200 -c:a copy output.mp4
llogan
  • 121,796
  • 28
  • 232
  • 243
  • Thanks you for your help. I tried : `-i, 15500649730000.mp4, -i, 12.png, -filter_complex, [0:v][1:v]overlay=10:10,drawtext=fontfile=MarkerFelt.ttf:text=mytext:fontcolor=orange@1.0:fontsize=30:x=30:y=200[output], -map, [output], -c:a, copy, 15500649730000.mp4` , i remove 0:a because i have no sound. Not working, no error and generate a file of 48 bytes. – Cleoh Feb 21 '19 at 16:13
  • @Cleoh Show the complete log from the `ffmpeg` process. – llogan Feb 21 '19 at 17:57
  • I think the problem is not the command because the process stops before it's over. ` E/DEBUGG: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 E/DEBUGG: frame= 13 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x E/DEBUGG: frame= 34 fps= 33 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x E/DEBUGG: frame= 47 fps= 14 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x` – Cleoh Feb 22 '19 at 08:36
  • Can't add complete logs, too many chars, i post only the end. – Cleoh Feb 22 '19 at 08:36
  • @Cleoh Unfortunately that is not informative. Instead of trying to cram everything into comments you can use a pastebin site and provide the link in a comment. – llogan Feb 22 '19 at 18:04
  • I used the third solution on another video and it works. I do not know why it does not work for the first video. I will test with 2 overlays and 1 text, i hope it will work too. – Cleoh Feb 25 '19 at 08:27
  • @Cleoh Unknown. Without the actual command and the complete log only guesses can be made but there are multiple possibilities of failure. – llogan Feb 25 '19 at 18:16
  • I finally found why the process stopped. Android kill it. – Cleoh Feb 26 '19 at 15:48