Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This below text outlines my troubles in trying to stream a video, generated on-the-fly from a list of image files, to an RTMP server. I can generate a playable video file. I can successfully stream some videos. But I can't do both in a single step.
- Successfully encoded images into a playable video:
- ffmpeg -framerate 1/10 -f image2 -i image%02d.png -r 25 -c:v libx264 -pix_fmt yuv420p video.mp4
- Attempt to generate the same video for sending to RTMP server( notice -re tag at beginning and '-f flv' at the end):
- ffmpeg -re -framerate 1/10 -f image2 -i image%02d.png -r 25 -c:v libx264 -pix_fmt yuv420p -f flv rtmp://live-sjc.twitch.tv/app/$(cat ~/twitch_key)
- Some console output:
- Input #0, image2, from 'image%02d.png':
- Duration: 00:02:10.00, start: 0.000000, bitrate: N/A
- Stream #0:0: Video: png, rgb24(pc), 640x480, 0.10 fps, 0.10 tbr, 0.10 tbn, 0.10 tbc
- [libx264 @ 0x7f8691098360] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA4 FMA3 LZCNT BMI1
- [libx264 @ 0x7f8691098360] profile High, level 3.0
- [libx264 @ 0x7f8691098360] 264 - core 144 r2533 c8a773e - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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 lookahead_threads=1 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=25 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-sjc.twitch.tv/app/live_94772137_zC3RWmdfCQFK9OKZN78x211LNtGrsL':
- Metadata:
- encoder : Lavf56.36.100
- Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 640x480, q=-1--1, 25 fps, 1k tbn, 25 tbc
- Metadata:
- encoder : Lavc56.41.100 libx264
- Stream mapping:
- Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
- Press [q] to stop, [?] for help
- frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A
- // The 'frame' and 'fps' fields change as ffmpeg goes through each image, but every other field stays the same
- // and then it outputs this:
- Press [q] to stop, [?] for help
- [flv @ 0x7f9fb220b520] Failed to update header with correct duration.A
- [flv @ 0x7f9fb220b520] Failed to update header with correct filesize.
- frame= 13 fps=2.4 q=-1.0 Lsize= 780kB time=00:00:03.36 bitrate=1900.7kbits/s
- video:779kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.069447%
- [libx264 @ 0x7f9fb220bd00] frame I:1 Avg QP:21.75 size: 51592
- [libx264 @ 0x7f9fb220bd00] frame P:12 Avg QP:21.96 size: 62121
- [libx264 @ 0x7f9fb220bd00] mb I I16..4: 0.2% 46.4% 53.4%
- [libx264 @ 0x7f9fb220bd00] mb P I16..4: 4.4% 47.5% 48.0% P16..4: 0.1% 0.0% 0.0% 0.0% 0.0% skip: 0.0%
- [libx264 @ 0x7f9fb220bd00] 8x8 transform intra:47.4% inter:83.3%
- [libx264 @ 0x7f9fb220bd00] coded y,uvDC,uvAC intra: 88.8% 86.8% 71.0% inter: 81.2% 66.7% 25.0%
- [libx264 @ 0x7f9fb220bd00] i16 v,h,dc,p: 30% 32% 9% 29%
- [libx264 @ 0x7f9fb220bd00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 25% 14% 6% 6% 6% 9% 7% 10%
- [libx264 @ 0x7f9fb220bd00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 21% 10% 7% 8% 8% 9% 7% 9%
- [libx264 @ 0x7f9fb220bd00] i8c dc,h,v,p: 45% 27% 19% 9%
- [libx264 @ 0x7f9fb220bd00] Weighted P-Frames: Y:16.7% UV:8.3%
- [libx264 @ 0x7f9fb220bd00] ref P L0: 8.3% 2.1% 50.0% 39.6%
- [libx264 @ 0x7f9fb220bd00] kb/s:1476.00
- Attempting to just stream the video file, output by the first commandline above, is also unsuccessful(this works for a couple of videos i've ripped from youtube):
- ffmpeg -re -i image_vid.mp4 -c copy -f flv rtmp://live-sjc.twitch.tv/app/$(cat ~/twitch_key)
- Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'image_vid.mp4':
- Metadata:
- major_brand : isom
- minor_version : 512
- compatible_brands: isomiso2avc1mp41
- encoder : Lavf56.36.100
- Duration: 00:00:26.00, start: 0.000000, bitrate: 352 kb/s
- Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 349 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
- Metadata:
- handler_name : VideoHandler
- [flv @ 0x7fe51af79ea0] Codec for stream 0 does not use global headers but container format requires global headers
- Output #0, flv, to 'rtmp://live-sjc.twitch.tv/app/live_94772137_zC3RWmdfCQFK9OKZN78x211LNtGrsL':
- Metadata:
- major_brand : isom
- minor_version : 512
- compatible_brands: isomiso2avc1mp41
- encoder : Lavf56.36.100
- Stream #0:0(und): Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 640x480, q=2-31, 349 kb/s, 30 fps, 30 tbr, 1k tbn, 15360 tbc (default)
- Metadata:
- handler_name : VideoHandler
- Stream mapping:
- Stream #0:0 -> #0:0 (copy)
- Press [q] to stop, [?] for help
- [flv @ 0x7fe51af79ea0] Failed to update header with correct duration.358.6kbits/s
- [flv @ 0x7fe51af79ea0] Failed to update header with correct filesize.
- frame= 780 fps= 30 q=-1.0 Lsize= 1124kB time=00:00:25.90 bitrate= 355.5kbits/s
- video:1108kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.407449%
Advertisement
Add Comment
Please, Sign In to add comment