[FFmpeg-user] Issues streaming to Twitch.tv

Jason Johnson spligak at gmail.com
Tue Sep 20 09:13:53 CEST 2011


I am currently using the following command to stream my desktop to
Twitch.tv:

ffmpeg -f x11grab -s "1024x768" -r "15" -i :0.0 -vcodec libx264 -s
> "1024x768" -f flv "rtmp://live.justin.tv/app/my_chan_key"
>

The command does result in a "stream" which is picked up by the servers
fine, except the stream is entirely black. The output from the above command
is as follows (please excuse the length, trying to be complete):

ffmpeg version N-32697-g4bc447a, Copyright (c) 2000-2011 the FFmpeg
> developers
>   built on Sep 18 2011 15:42:01 with gcc 4.5.2
>   configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
> --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora
> --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree
> --enable-postproc --enable-version3 --enable-x11grab
>   libavutil    51. 16. 0 / 51. 16. 0
>   libavcodec   53. 16. 0 / 53. 16. 0
>   libavformat  53. 12. 0 / 53. 12. 0
>   libavdevice  53.  4. 0 / 53.  4. 0
>   libavfilter   2. 43. 2 /  2. 43. 2
>   libswscale    2.  1. 0 /  2.  1. 0
>   libpostproc  51.  2. 0 / 51.  2. 0
> [x11grab @ 0x2feca00] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1024
> height: 768
> [x11grab @ 0x2feca00] shared memory extension found
> [x11grab @ 0x2feca00] Estimating duration from bitrate, this may be
> inaccurate
> Input #0, x11grab, from ':0.0':
>   Duration: N/A, start: 1316500191.510707, bitrate: 377487 kb/s
>     Stream #0.0: Video: rawvideo (BGRA / 0x41524742), bgra, 1024x768,
> 377487 kb/s, 15 tbr, 1000k tbn, 15 tbc
> Incompatible pixel format 'bgra' for codec 'libx264', auto-selecting format
> 'yuv420p'
> [buffer @ 0x2ffd2e0] w:1024 h:768 pixfmt:bgra tb:1/1000000 sar:0/1
> sws_param:
> [buffersink @ 0x2ffd6e0] auto-inserting filter 'auto-inserted scale 0'
> between the filter 'src' and the filter 'out'
> [scale @ 0x2ffdee0] w:1024 h:768 fmt:bgra -> w:1024 h:768 fmt:yuv420p
> flags:0x4
> [libx264 @ 0x2ffa3e0] using cpu capabilities: MMX2 SSE2Fast FastShuffle
> SSEMisalign LZCNT
> [libx264 @ 0x2ffa3e0] profile High, level 3.1
> [libx264 @ 0x2ffa3e0] 264 - core 116 r2074 2641b9e - H.264/MPEG-4 AVC codec
> - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options:
> cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
> psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1
> cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6
> sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
> constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
> weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 scenecut=40
> intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
> qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
> Output #0, flv, to 'rtmp://live.justin.tv/app/my_chan_key':
>   Metadata:
>     encoder         : Lavf53.12.0
>     Stream #0.0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 1024x768,
> q=-1--1, 1k tbn, 15 tbc
> Stream mapping:
>   Stream #0.0 -> #0.0 (rawvideo -> libx264)
> Press [q] to stop, [?] for help
> frame=  109 fps= 13 q=32766.0 Lsize=     461kB time=00:00:08.73 bitrate=
> 432.0kbits/s dup=0 drop=10
> video:458kB audio:0kB global headers:0kB muxing overhead 0.522560%
> frame I:1     Avg QP:11.86  size:121831
> [libx264 @ 0x2ffa3e0] frame P:36    Avg QP:17.86  size:  9491
> [libx264 @ 0x2ffa3e0] frame B:72    Avg QP:27.49  size:    70
> [libx264 @ 0x2ffa3e0] consecutive B-frames: 11.0%  1.8%  2.8% 84.4%
> [libx264 @ 0x2ffa3e0] mb I  I16..4: 14.5% 49.7% 35.8%
> [libx264 @ 0x2ffa3e0] mb P  I16..4:  0.3%  0.4%  2.8%  P16..4:  2.6%  0.6%
> 0.5%  0.0%  0.0%    skip:92.8%
> [libx264 @ 0x2ffa3e0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.6%  0.0%
> 0.0%  direct: 0.0%  skip:99.4%  L0:34.5% L1:65.5% BI: 0.1%
> [libx264 @ 0x2ffa3e0] 8x8 transform intra:28.0% inter:35.3%
> [libx264 @ 0x2ffa3e0] coded y,uvDC,uvAC intra: 77.7% 45.2% 32.5% inter:
> 0.4% 0.3% 0.1%
> [libx264 @ 0x2ffa3e0] i16 v,h,dc,p: 30% 51%  4% 14%
> [libx264 @ 0x2ffa3e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 18% 34%  4%  7%
> 5%  7%  5%  6%
> [libx264 @ 0x2ffa3e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 27% 17%  4%  5%
> 5%  5%  4%  6%
> [libx264 @ 0x2ffa3e0] i8c dc,h,v,p: 62% 23% 13%  2%
> [libx264 @ 0x2ffa3e0] Weighted P-Frames: Y:0.0% UV:0.0%
> [libx264 @ 0x2ffa3e0] ref P L0: 80.8%  4.3% 12.3%  2.5%
> [libx264 @ 0x2ffa3e0] ref B L0: 55.2% 27.5% 17.3%
> [libx264 @ 0x2ffa3e0] ref B L1: 90.7%  9.3%
> [libx264 @ 0x2ffa3e0] kb/s:422.72
>


When I output the file to my desktop like so:

ffmpeg -f x11grab -s "1024x768" -r "15" -i :0.0 -vcodec libx264 -s
> "1024x768" -f flv ~/Desktop/test.flv
>

It plays fine.

Also of note, while ffmpeg reports to be streaming the data - however, the
Ubuntu System Monitor shows abrupt momentary network activity, then zero
network activity. This I believe would indicate some issue in configuration
of the RTMP stuff.

Any help in understanding what's going wrong here would be much appreciated.


More information about the ffmpeg-user mailing list