Ask Your Question

asymptote's profile - activity

2019-11-13 01:32:51 -0600 received badge  Famous Question (source)
2018-10-27 03:16:57 -0600 received badge  Notable Question (source)
2018-10-17 02:23:36 -0600 received badge  Notable Question (source)
2018-05-10 00:47:18 -0600 received badge  Popular Question (source)
2017-10-31 00:33:07 -0600 received badge  Popular Question (source)
2017-09-18 21:24:24 -0600 received badge  Student (source)
2016-06-06 06:08:00 -0600 answered a question Processing Camera stream in Opencv, pushing it over RTMP (NGINX RTMP Module) using FFMPEG

It had to do with the fps of input stream (which was extremely low) and HLS settings on my streaming server. Once I reduced the packet length (in time) it worked fine.

2016-06-06 06:01:50 -0600 asked a question cmake not picking GStreamer on Ubuntu

Hi

I want to build opencv with GStreamer support.

I built the GStreamer from source (version 1.8.1) following this guide: http://kacianka.at/?p=145 I have 'gstreamer_build' folder at my home directory and it contains 'bin' folder with these:

gst-device-monitor-1.0 gst-discoverer-1.0 gst-inspect-1.0 gst-launch-1.0 gst-play-1.0 gst-stats-1.0 gst-typefind-1.0 orc-bugreport orcc

I have this path added to my environment variable PATH.

When I use cmake like:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules -D BUILD_opencv_python3=ON -D WITH_GSTREAMER=ON -D WITH_FFMPEG=OFF ..

I get the following output clearly indicating that gstreamer is not found:

-- checking for module 'gstreamer-base-1.0'
--   package 'gstreamer-base-1.0' not found
-- checking for module 'gstreamer-video-1.0'
--   package 'gstreamer-video-1.0' not found
-- checking for module 'gstreamer-app-1.0'
--   package 'gstreamer-app-1.0' not found
-- checking for module 'gstreamer-riff-1.0'
--   package 'gstreamer-riff-1.0' not found
-- checking for module 'gstreamer-pbutils-1.0'
--   package 'gstreamer-pbutils-1.0' not found
-- checking for module 'gstreamer-base-0.10'
--   package 'gstreamer-base-0.10' not found
-- checking for module 'gstreamer-video-0.10'
--   package 'gstreamer-video-0.10' not found
-- checking for module 'gstreamer-app-0.10'
--   package 'gstreamer-app-0.10' not found
-- checking for module 'gstreamer-riff-0.10'
--   package 'gstreamer-riff-0.10' not found
-- checking for module 'gstreamer-pbutils-0.10'
--   package 'gstreamer-pbutils-0.10' not found

and this:

Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      NO
--       codec:                     NO
--       format:                    NO
--       util:                      NO
--       swscale:                   NO
--       resample:                  NO
--       gentoo-style:              NO
--     GStreamer:                   NO
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     OpenNI2:                     NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    Using libv4l1 (ver 1.0.1) / libv4l2 (ver 1.0.1)
--     XIMEA:                       NO
--     Xine:                        NO
--     gPhoto2:                     NO

Can anyone help me with this?

2016-04-13 03:23:58 -0600 received badge  Enthusiast
2016-04-11 09:02:48 -0600 received badge  Editor (source)
2016-04-11 05:54:49 -0600 asked a question Processing Camera stream in Opencv, pushing it over RTMP (NGINX RTMP Module) using FFMPEG

Output video: https://youtu.be/VxfoBQjoY6E

Explanation:

I want to: Process camera stream in Opencv and push it over to RTMP server. I already have NGINX (RTMP module) set up and I have tested streaming videos with both RTMP (Flash Player) and HLS.

I am reading the frames in a loop and using 'subprocess' in python to execute ffmpeg command. Here's the command I am using:

command = [ffmpeg,
    '-y',
    '-f', 'rawvideo',
    '-vcodec','rawvideo',
    '-pix_fmt', 'bgr24',
    '-s', dimension,
    '-i', '-',
    '-c:v', 'libx264',
    '-pix_fmt', 'yuv420p',
    '-preset', 'ultrafast',
    '-f', 'flv',
    'rtmp://10.10.10.80/live/mystream']


import subprocess as sp
...
proc = sp.Popen(command, stdin=sp.PIPE,shell=False)
...
proc.stdin.write(frame.tostring()) #frame is read using opencv

Problem:

I can see the stream fine but it freezes and resumes frequently. Here's the output of FFMPEG terminal log:

Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
frame=  117 fps= 16 q=22.0 size=     344kB time=00:00:04.04 bitrate= 697.8kbits/s speed=0.543x

It mentions speed at the end. I believe it should be close to 1x. I am not sure how to achieve that.

And I am on the same network as server, I can post my python code if required. Need some ffmpeg guru to give me some advise.