[FFmpeg-user] Encode to Side by Side Video

Thilo Borgmann thilo.borgmann at googlemail.com
Mon Jun 4 20:21:42 CEST 2012


Am 04.06.12 19:27, schrieb Kyle Schwarz:
> On Wed, May 30, 2012 at 3:18 PM, Lou <lou at lrcd.com> wrote:
>>
>> On Wed, 30 May 2012 17:49:19 +0000 (UTC)
>> Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>>
>>> Kyle <kshawkeye <at> gmail.com> writes:
>>>
>>>> I'm wondering if FFmpeg can encode two different videos
>>>> into one video that plays both side by side?
>>>
>>> Did you try the video filter system?
>>> Overlay worked fine when I tried it once.
>>>
>>> Carl Eugen
>>
>> Overlay as Carl mentioned:
>> ffmpeg -i right.mp4 -filter:v
>> "[in]setpts=PTS-STARTPTS,pad=iw*2:ih:iw:0,[T1]overlay=0:0[out];movie=left.mp4,setpts=PTS-STARTPTS[T1]"
>> output
> 
> I tried the given example and got:
> ffmpeg -y
>  -i "input-1.flv" -filter:v "[in]setpts=PTS-STARTPTS,pad=iw*2:ih:iw:0,[T1]overla
> y=0:0[out];movie=input-2.flv,setpts=PTS-STARTPTS[T1]" output.mp4
> ffmpeg version N-41195-g8a0efa9 Copyright (c) 2000-2012 the FFmpeg developers
>   built on May 31 2012 20:10:06 with gcc 4.6.3
>   configuration: --disable-static --enable-shared --enable-gpl --enable-version3
>  --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzli
> b --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --
> enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lam
> e --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
>  --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc
> --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --en
> able-libxavs --enable-libxvid --enable-zlib
>   libavutil      51. 55.100 / 51. 55.100
>   libavcodec     54. 23.100 / 54. 23.100
>   libavformat    54.  6.101 / 54.  6.101
>   libavdevice    54.  0.100 / 54.  0.100
>   libavfilter     2. 77.100 /  2. 77.100
>   libswscale      2.  1.100 /  2.  1.100
>   libswresample   0. 15.100 /  0. 15.100
>   libpostproc    52.  0.100 / 52.  0.100
> Input #0, flv, from 'input-1.flv':
>   Metadata:
>     starttime       : 0
>     totalduration   : 474
>     totaldatarate   : 1005
>     bytelength      : 59533158
>     canseekontime   : true
>     sourcedata      : B4A7D0021HH1338775178100633
>     purl            :
>     pmsg            :
>   Duration: 00:07:53.76, start: 0.000000, bitrate: 1005 kb/s
>     Stream #0:0: Video: h264 (Main), yuv420p, 854x480, 890 kb/s, 25 tbr, 1k tbn,
>  50 tbc
>     Stream #0:1: Audio: aac, 44100 Hz, stereo, s16, 130 kb/s
> [movie @ 0000000002bfdd80] seek_point:0 format_name:(null) file_name:input-2.flv
>  stream_index:0
> [buffer @ 000000000092e2e0] w:854 h:480 pixfmt:yuv420p tb:1/1000 sar:0/1 sws_par
> am:flags=2
> [buffersink @ 000000000092e5e0] No opaque field provided
> [overlay @ 0000000002ed7cc0] auto-inserting filter 'auto-inserted scaler 0' betw
> een the filter 'Parsed_pad_1' and the filter 'Parsed_overlay_2'
> [movie @ 0000000002bfdd80] TB:0.001000
> [buffer @ 000000000092e2e0] TB:0.001000
> [pad @ 0000000002ed7c40] w:854 h:480 -> w:1708 h:480 x:854 y:0 color:0x000000FF
> [scale @ 0000000000533320] w:1708 h:480 fmt:yuv420p sar:0/1 -> w:1708 h:480 fmt:
> yuva420p sar:0/1 flags:0x4
> [overlay @ 0000000002ed7cc0] main w:854 h:480 fmt:yuv420p overlay x:0 y:0 w:1708
>  h:480 fmt:yuva420p
> [overlay @ 0000000002ed7cc0] Overlay area (0,0)<->(1708,480) not within the main
>  area (0,0)<->(854,480) or zero-sized
> Error opening filters!
> 
> I also tried the first example given in the doc for libavfilter and
> that also failed with a similar message.
> 
> Any ideas?

This is a little snippet from an ancient version of ffmpeg... A first look
reveals different parameters for the pad filter but things might have changed in
the mean time. Maybe it can help you anyway because this line definitely worked
some day...

ffmpeg -i 0208a.mp4 -vf "movie=0:0:sa.mp4 [movie]; [in] fifo, pad=2592:964:0:0,
[movie] overlay=1296:0 [out]" -sameq -y out.mp4

-Thilo


More information about the ffmpeg-user mailing list