title: Can stream to Facebook using ffmpeg but not when using tee
body: <p>I'm trying to stream to YouTube and Facebook simultaneously using ffmpeg.</p>
  
  <p>I can do them individually, but I want to use "tee" to send the results of encoding to two places.</p>
  
  <p>If I do:</p>
  
  <pre><code>ffmpeg -re -i pipe:0 -acodec libfdk_aac -bsf:a aac_adtstoasc \
      -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline \
      -s 720x480 -bufsize 2048k -vb 1300k -maxrate 4000k -deinterlace \
      -vcodec libx264 -g 25 -r 25 \
      -f flv "rtmp://rtmp-api.facebook.com:80/rtmp/key"
  </code></pre>
  
  <p>It works just fine. </p>
  
  <p>But if I do:</p>
  
  <pre><code>ffmpeg -re -i pipe:0 -acodec libfdk_aac -bsf:a aac_adtstoasc \
      -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline \
      -s 720x480 -bufsize 2048k -vb 1300k -maxrate 4000k -deinterlace \
      -vcodec libx264 -g 25 -r 25 \
      -f tee -map 0:v -map 0:a \
      "[f=flv]rtmp://rtmp-api.facebook.com:80/rtmp/key"
  </code></pre>
  
  <p>Then I get a rtmp 104 error.</p>
  
  <p>If that would work then I could just do:</p>
  
  <pre><code>        "[f=flv]rtmp://rtmp-api.facebook.com:80/rtmp/key|[f=flv]rtmp://youtube.etc"
  </code></pre>
  
  <p>And that would stream to both.</p>
  
  <p>I did find out that I needed "-bsf:a aac_adtstoasc" otherwise the encoder broke, complaining about malformed bits.</p>
  
  <p>Any ideas?</p>
  
  <p>The error is only with Facebook. YouTube works fine.</p>
  
  <p>Console output:</p>
  
  <pre><code>  Metadata:
      encoder         : Lavf57.72.101
      Stream #0:0: Video: h264 (libx264), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=-1--1, 1300 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
      Metadata:
        encoder         : Lavc57.95.101 libx264
      Side data:
        cpb: bitrate max/min/avg: 2000000/0/1300000 buffer size: 2048000 vbv_delay: -1
      Stream #0:1: Audio: aac (libfdk_aac), 44100 Hz, stereo, s16, 128 kb/s
      Metadata:
        encoder         : Lavc57.95.101 libfdk_aac
  frame=   61 fps= 30 q=25.0 size=N/A time=00:00:01.97 bitrate=N/A speed=0.961x        
  WriteN, RTMP send error 104 (136 bytes)
  </code></pre>