I am trying to use raspivid
as an input for ffmpeg
I'm testing the {code from this question}(How can I stream H.264 video from the Raspberry Pi camera module via a web server?). Initially I was using my own code, but I want to see if I can get it working under identical circumstances that they did.
However, I am recieving the following error:
pi@raspberrypi ~ $ /usr/share/nginx/www/video.sh
ffmpeg version N-75462-g01770bf Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.6 (Debian 4.6.3-14+rpi1)
configuration:
libavutil 55. 2.100 / 55. 2.100
libavcodec 57. 3.100 / 57. 3.100
libavformat 57. 2.100 / 57. 2.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 6.100 / 6. 6.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
Input #0, h264, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 720x404, 25 fps, 25 tbr, 1200k tbn, 50 tbc
[stream_segment,ssegment @ 0x1fadbd0] Failed to open segment 'segments/00000000.ts'
Output #0, stream_segment,ssegment, to 'segments/%08d.ts':
Metadata:
encoder : Lavf57.2.100
Stream #0:0: Video: h264, yuv420p, 720x404, q=2-31, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory
rm: cannot remove `stream.m3u8': No such file or directory
rm: cannot remove `segments/*.ts': No such file or directory
I can see that it's capturing video because the light lights up, but it's saying it's failing to open the "segments" file, then later saying it cannot write the file 0. I've checked the permissions and added www-data
to group, but it does not appear to have fixed it.
Any idea how to get raspivid streaming as an input to ffmpeg?
EDIT: By request, here is `video.sh'
#!/bin/bash
base="/usr/share/nginx/www/"
cd $base
raspivid -n -w 720 -h 405 -fps 25 -vf -t 86400000 -b 1800000 -ih -o - \
| ffmpeg -y \
-i - \
-c:v copy \
-map 0:0 \
-f ssegment \
-segment_time 4 \
-segment_format mpegts \
-segment_list "$base/stream.m3u8" \
-segment_list_size 720 \
-segment_list_flags live \
-segment_list_type m3u8 \
"segments/%08d.ts"
trap "rm stream.m3u8 segments/*.ts" EXIT
# vim:ts=2:sw=2:sts=2:et:ft=sh
The full instructions is available in the link at the top.
plcvideo.sh
from here, so you'll have to post it so I can see the command line parameters for ffmpeg – Jaromanda X Sep 21 '15 at 05:25| ffmpeg -y
-i -
-c:v copy
-map 0:0
-f ssegment
-segment_time 4
-segment_format mpegts
-segment_list "$base/stream.m3u8"
-segment_list_size 720
-segment_list_flags live
-segment_list_type m3u8
"segments/%08d.ts" – jfa Sep 21 '15 at 05:26
base
is/data/live
as per that script? and you do have asegments
folder in thenginx/www
folder? – Jaromanda X Sep 21 '15 at 05:28/usr/share/nginx/www/
– jfa Sep 21 '15 at 05:29