Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg: Streamcopy requested for output stream 0:0, which is fed from a complex filtergraph. Filtering and streamcopy cannot be used together

Tags:

I'm on Fedora25 running the following command expecting live streaming to youtube and at the same time saving of the final combined stream (screencast + webcam + logo + audio) into local mp4 file.

ffmpeg \
-f x11grab -video_size 3840x2160 -framerate 30 -i :1.0 \
-f v4l2 -video_size 320x240 -framerate 30 -i /dev/video1 \
-f alsa -ac 2 -i pulse -i logo.png -filter_complex \
"[0:v]scale=1920:-1,setpts=PTS-STARTPTS[bg]; \
 [1:v]scale=160:-1,setpts=PTS-STARTPTS[fg]; \
 [bg][fg]overlay=W-w-10:10[bg2]; \
 [bg2][3:v]overlay=W-w-10:H-h-10,format=yuv420p[out]" \
-map "[out]" -map 2:a -c:v libx264 -preset veryfast \
-maxrate 9000k -bufsize 12000k -c:a aac -b:a 160k -ar 44100 -b:a 128k \
-force_key_frames "expr:gte(t,n_forced*2)" \
-c copy -f flv rtmp://a.rtmp.youtube.com/live2/TOKEN
-c copy -f mp4 out.mp4

getting the following output

ffmpeg version 3.1.7 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.1 (GCC) 20161221 (Red Hat 6.3.1-1)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --extra-cflags=-I/usr/include/nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[x11grab @ 0x562f6e929c20] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':1.0':
  Duration: N/A, start: 1496800335.695598, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 3840x2160, 30 fps, 1000k tbr, 1000k tbn, 1000k tbc
Input #1, video4linux2,v4l2, from '/dev/video1':
  Duration: N/A, start: 17665.258327, bitrate: 36864 kb/s
    Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 36864 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #2.0 : stereo
Input #2, alsa, from 'pulse':
  Duration: N/A, start: 1496800336.972575, bitrate: 1536 kb/s
    Stream #2:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Input #3, png_pipe, from 'logo.png':
  Duration: N/A, bitrate: N/A
    Stream #3:0: Video: png, rgba(pc), 190x105 [SAR 2835:2835 DAR 38:21], 25 tbr, 25 tbn, 25 tbc
Streamcopy requested for output stream 0:0, which is fed from a complex filtergraph. Filtering and streamcopy cannot be used together.
➜  tmp 
like image 994
DmitrySemenov Avatar asked Jun 07 '17 01:06

DmitrySemenov


1 Answers

Since you are filtering or encoding the input streams, you can't do a stream copy on the input. Remove -c copy altogether.

like image 179
Gyan Avatar answered Sep 30 '22 14:09

Gyan