[FFmpeg-user] [ffmpeg] how to merge two slices from independent two video TS

Moritz Barsnick barsnick at gmx.net
Tue Sep 11 12:09:57 EEST 2018

Hi yiyi,

On Tue, Sep 11, 2018 at 12:36:45 +0800, 杨阳 wrote:
> I have a requirement about 2 udp videos(H264 TS) merge into 1 (HEVC
> TS). Two videos show in left & right side screen at the same time.

When you write "show", you mean to display with ffplay?

> But I don't want to do decoder.

Well, to display *any* video at all, you need to decode it. That's just
how video encoding and decoding works by concept. If you mean you don't
want to *re-encode*, then you can't create a new video (because a new
video needs to be encoded, if the streams are to be displayed side by

> Because it costs too much cpu.

Decoding shouldn't cost too much CPU, unless you are on a really weak
device. And see above: You must decode at some point.

Assuming you mean to display side by side, without recoding, you can
use ffplay. In general, ffplay only supports one input, but using a
complex filter chain with the "movie" filter, you can combine various
inputs, even streams.

To put video streams side-by-side, you use the hstack filter.

In total, a command line would look something like this. Note that the
quoting was done for Windows, but might work for Unix al well:

$ ffplay -f lavfi "movie='udp\://localhost\:9011'[a]; movie='udp\://localhost\:9012'[b]; [a][b]hstack"

(This works for me (TM).)

> I have found a post in
> https://lists.ffmpeg.org/pipermail/ffmpeg-user/2012-August/009220.html,
> but i can't get the point from that.

Totally unrelated.


More information about the ffmpeg-user mailing list