I am using the following bash script to pipe the output of OpenCV which is an out.avi file converting that file to a stdout using the tail command and piping the output to ffmpeg
./OpenCV & \
tail -n +0 -f out.avi | ffmpeg -i pipe:0 -hls_time 1 -hls_list_size 0 -hls_wrap 10 -hls_segment_filename '%03d.ts' stream.m3u8
This works but causes latency issues.
I have tried to change the C++ code so that the frame gets written to a stdout using cout << frame;
here is some of the code.
imshow( window_name, frame );//show frame
video.write(frame);//rec to avi
cout << frame;
From the above code I get the window to display the processed image, the frame is saved in avi format and from the last line i get printed to the command line the pixel values of the frames.
Now I have tried the following Bash script to pipe this stdout to ffmpeg with no success.
./OpenCV | ffmpeg -i pipe:0 -hls_time 1 -hls_list_size 0 -hls_wrap 10 -hls_segment_filename '%03d.ts' stream.m3u8
I also tried
./OpenCV | ffmpeg -i pipe:0 -f rawvideo -pix_fmt bgr24 -s 480x320 -hls_time 1 -hls_list_size 0 -hls_wrap 10 -hls_segment_filename '%03d.ts' stream.m3u8
Anybody got any ideas?