Posts: 64
Joined: Sun Sep 09, 2012 6:13 pm

possible to pipe to ffmpeg?

Tue May 05, 2015 4:27 pm


Code: Select all

raspivid -t 0-o -| ffmpeg -i - -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 output.mp4 
I am able to pipe to ffmpeg, but it seems to be very slow:

Code: Select all

 Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native))
frame=    2 fps=1.9 q=1.6 size=      70kB time=00:00:00.08 bitrate=7214.8kbits/sframe=    3 fps=1.2 q=2.0 size=     129kB time=00:00:00.12 bitrate=8804.9kbits/sframe=    4 fps=0.9 q=4.0 size=     171kB time=00:00:00.16 bitrate=8765.9kbits/sframe=    5 fps=0.8 q=6.3 size=     202kB time=00:00:00.20 bitrate=8289.8kbits/sframe=    6 fps=0.7 q=6.4 size=     250kB time=00:00:00.24 bitrate=8532.8kbits/sframe=    7 fps=0.7 q=8.8 size=     282kB time=00:00:00.28 bitrate=8265.1kbits/sframe=    8 fps=0.7 q=11.5 size=     297kB time=00:00:00.32 bitrate=7605.4kbits/frame=    9 fps=0.6 q=14.3 size=     303kB time=00:00:00.36 bitrate=6904.8kbits/frame=   10 fps=0.6 q=17.2 size=     309kB time=00:00:00.40 bitrate=6330.4kbits/frame=   11 fps=0.6 q=20.1 size=     314kB time=00:00:00.44 bitrate=5847.9kbits/frame=   12 fps=0.6 q=23.1 size=     318kB time=00:00:00.48 bitrate=5428.9kbits/frame=   13 fps=0.6 q=26.0 size=     322kB time=00:00:00.52 bitrate=5069.4kbi
is there any possibility to handle an on-the-fly convert on raspi?

Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7542
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: possible to pipe to ffmpeg?

Tue May 05, 2015 4:41 pm

You're transcoding form H264 to MPEG4, hence why it is so slow.

Code: Select all

raspivid -t 0 -o -| ffmpeg -i - -vcodec copy output.mp4 
will package up the H264 stream on the fly.
There's no chance that the Pi ARM will manage a real-time transcode from H264 to MPEG4. The GPU can do MPEG4 (up to 720P30), but I don't know if the licence enables that.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”