[libav-tools] capture and stream to rtmp from a single source?

Jeremy Hansen jeremy at skidrow.la
Fri Dec 13 19:49:41 CET 2013


On Dec 13, 2013, at 5:25 AM, Luca Barbato <lu_zero at gentoo.org> wrote:

> On 12/12/13 05:10, Jeremy Hansen wrote:
>> 
>> 
>> On Dec 11, 2013, at 5:32 AM, Luca Barbato <lu_zero at gentoo.org> wrote:
>> 
>>> On 11/12/13 03:41, Jeremy Hansen wrote:
>>>> 
>>>> Right now I’m using avconv to capture video from a BlackMagic Design Mini Recorder PCIe card.  This is working great.  My next step is to trying to stream live to a rtmp server (Using nginx and the rtmp module).  
>>>> 
>>>> Here’s my current command line:
>>>> 
>>>> bmdcapture -C 0 -m 14 -V 3 -A 2 -F nut -f pipe:1 | \
>>>> avconv -y -i - -c:v libx264 -c:a aac -ar 44100 -strict experimental -s 640x360 -b:a 160k /pub/video/"$SHOW"_$TIME.mp4
>>>> 
>>>> What would I have to do to stream to rtmp as well?
>>>> 
>>> 
>>> Have a rtmp server somewhere (crtmpd is my current favourite) and
>>> replace /pub/video/"$SHOW"_$TIME.mp4 with rtmp://serverhost/app/path/
>> 
>> Understood, but I’m trying to write to both a file and a stream simultaneously.  
>> 
>> I have this working…meaning, it starts, but rapidly fails after a few moments.  Here’s my current command line:
>> 
>> bmdcapture -C 0 -m 14 -V 3 -A 2 -F nut -f pipe:1 | avconv -y -i - -copytb -c:v libx264 -c:a aac -ar 44100 -strict experimental -s 640x360 -b:a 160k /pub/video/"$SHOW"_$TIME.mp4 -f flv  -c:v libx264 -c:a aac -ar 22050 -strict experimental -s 384x216 -b:a 64k rtmp://live.mysite.com/myapp/video
>> 
>> But it fails after some moments with this error:
>> 
>> Stopping Capture 22 q=28.0 q=31.0 size= 5138kB time=62.48 bitrate= 673.6kbits/s
>> Failed to update header with correct duration.0kB time=62.96 bitrate= 672.7kbits/s 
>> [flv @ 0x248b7c0] Failed to update header with correct file size.
>> 
>> Any clues as to what this is?
> 
> Your system is too probably slow, add -preset ultrafast so x264 won’t
> tax it too much.

Thanks.  Do I add this to the first x264 for the file or for the rtmp stream or both?

-jeremy


> 
> crtmpd has a commercial variant doing pretty much all you want
> streaming-wise, I hadn't tried myself but I heard good informations
> about it.
> 
> lu
> _______________________________________________
> libav-tools mailing list
> libav-tools at libav.org
> https://lists.libav.org/mailman/listinfo/libav-tools



More information about the libav-tools mailing list