logo
down
shadow

encode stream from webCam h264


encode stream from webCam h264

Content Index :

encode stream from webCam h264
Tag : javascript , By : Nigel
Date : November 24 2020, 03:41 PM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Encode h264 to match existing stream


Tag : video , By : Menno
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Finally I solved it myself. Turns out that you only need to match the image size and aspect ratio, so it can be as simple as:
x264_param_t xparam ;
x264_param_default( &xparam );

xparam.i_width          = width  ;
xparam.i_height         = height ;
xparam.vui.i_sar_height = 1      ;
xparam.vui.i_sar_width  = 1      ;

x264_t * x264 = x264_encoder_open( &xparam );

h264 encode video stream ffmpeg c++


Tag : cpp , By : user170635
Date : March 29 2020, 07:55 AM
wish help you to fix your issue According to the documentation, you need to pass an output format to avformat_alloc_output_context2.
To quote (content in square brackets mine):

Media Foundation webcam video H264 encode/decode produces artifacts when played back


Tag : cpp , By : Mforg
Date : March 29 2020, 07:55 AM
will be helpful for those in need I'm a little late to the game here but I can confirm that the answer from Homepage is the correct solution. I also encountered this same problem but I was only using the decoder portion of this sample code. I was reading in an MP4 file and saw the increasing artifacts between key frames. As soon as I received a key frame, the image looked good and then progressively got worse. Here is the code I added within the Codec::InitializeDecoder():
// Set CODECAPI_AVLowLatencyMode
ICodecAPI *mpCodecAPI = NULL;
hr = pDecoderTransform->QueryInterface(IID_PPV_ARGS(&mpCodecAPI));
CHECK_HR(hr, "Failed to get ICodecAPI.\n");

VARIANT var;
var.vt = VT_BOOL;
var.boolVal = VARIANT_TRUE;
hr = mpCodecAPI->SetValue(&CODECAPI_AVLowLatencyMode, &var);
CHECK_HR(hr, "Failed to enable low latency mode.\n");

How to get non-decoded h264 stream from the webcam using ffmpeg?


Tag : ffmpeg , By : fedorafennec
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I want to get the file which is non-decoded h264 format to use in another client application. I know how to stream to disk using below command from the docs. , I found this as solution
ffmpeg  -pix_fmt yuv420p -y -f v4l2 -vcodec h264  -i /dev/video0 out.h264

Raspberry Pi : use VLC to stream webcam : Logitech C920 [H264 Video without transcoding + Audio + LED control] - SpyCam


Tag : http , By : Mare Astra
Date : March 29 2020, 07:55 AM
With these it helps This solution is tested and working with versions indicated below. Using this method, the RaspberryPi3 is always around 5% CPU.
edit 2018-11-18: One can also see the all-in-one solution prototype on RaspiVWS project homepage (for curious people, see GitHub project)
lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.4 (stretch)
Release:        9.4
Codename:       stretch
sudo apt-get install vlc
sudo apt-get install v4l-utils
pi@raspberrypi:~ $ v4l2-ctl --all
Driver Info (not using libv4l2):
    Driver name   : uvcvideo
    Card type     : HD Pro Webcam C920
    Bus info      : usb-3f980000.usb-1.5
    Driver version: 4.14.30
    Capabilities  : 0x84200001
        Video Capture
        Streaming
        Extended Pix Format
        Device Capabilities
    Device Caps   : 0x04200001
        Video Capture
        Streaming
        Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
    Width/Height      : 1920/1080
    Pixel Format      : 'H264'
    Field             : None
    Bytes per Line    : 3840
    Size Image        : 4147200
    Colorspace        : sRGB
    Transfer Function : Default
    YCbCr/HSV Encoding: Default
    Quantization      : Default
    Flags             : 
Crop Capability Video Capture:
    Bounds      : Left 0, Top 0, Width 1920, Height 1080
    Default     : Left 0, Top 0, Width 1920, Height 1080
    Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 1920, Height 1080
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1080
Streaming Parameters Video Capture:
    Capabilities     : timeperframe
    Frames per second: 30.000 (30/1)
    Read buffers     : 0
                     brightness (int)    : min=0 max=255 step=1 default=-8193 value=128
                       contrast (int)    : min=0 max=255 step=1 default=57343 value=128
                     saturation (int)    : min=0 max=255 step=1 default=57343 value=128
 white_balance_temperature_auto (bool)   : default=1 value=1
                           gain (int)    : min=0 max=255 step=1 default=57343 value=255
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2000 max=6500 step=1 default=57343 value=4822 flags=inactive
                      sharpness (int)    : min=0 max=255 step=1 default=57343 value=128
         backlight_compensation (int)    : min=0 max=1 step=1 default=57343 value=0
                  exposure_auto (menu)   : min=0 max=3 default=0 value=3
              exposure_absolute (int)    : min=3 max=2047 step=1 default=250 value=333 flags=inactive
         exposure_auto_priority (bool)   : default=0 value=1
                   pan_absolute (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                  tilt_absolute (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                 focus_absolute (int)    : min=0 max=250 step=5 default=8189 value=0 flags=inactive
                     focus_auto (bool)   : default=1 value=1
                  zoom_absolute (int)    : min=100 max=500 step=1 default=57343 value=100
                      led1_mode (menu)   : min=0 max=3 default=3 value=3
                 led1_frequency (int)    : min=0 max=255 step=1 default=0 value=0
v4l2-ctl -d0 --set-ctrl=led1_mode=0
v4l2-ctl -d0 --set-ctrl=led1_frequency=30
pi@raspberrypi:~ $ arecord -l
**** Liste des Périphériques Matériels CAPTURE ****
carte 1: C920 [HD Pro Webcam C920], périphérique 0: USB Audio [USB Audio]
  Sous-périphériques: 1/1
  Sous-périphérique #0: subdevice #0
cvlc v4l2:///dev/video0:chroma=h264 :input-slave=alsa://hw:1,0 --sout '#transcode{acodec=mpga,ab=128,channels=2,samplerate=44100,threads=4,audio-sync=1}:standard{access=http,mux=ts,mime=video/ts,dst=:8099}'
cvlc --sout-file-format v4l2:///dev/video0:<...> dst='/home/pi/Webcam_Record/%F_%T_MyVid.mp4'}
#!/bin/bash
# auto stream launch + led off
#cvlc -vvv for verbose debug

# change this value to adapt to your webcam device number
deviceNb=0

# force video format + led off
v4l2-ctl -d${deviceNb} --set-fmt-video=width=1920,height=1080,pixelformat=1 --set-ctrl=led1_mode=0

# if delay needed 
# cvlc v4l2:///dev/video${deviceNb}:chroma=h264 :input-slave=alsa://hw:1,0  :live-caching=2500  --sout '#transcode{acodec=mpga,ab=128,channels=2,samplerate=44100,threads=4,audio-sync=1}:standard{access=http,mux=ts,mime=video/ts,dst=:8099}'

# no delay
cvlc v4l2:///dev/video${deviceNb}:chroma=h264 :input-slave=alsa://hw:1,0 --sout '#transcode{acodec=mpga,ab=128,channels=2,samplerate=44100,threads=4,audio-sync=1}:standard{access=http,mux=ts,mime=video/ts,dst=:8099}'
cd /lib/systemd/system/
sudo nano webcam-stream.service
[Unit]
Description=Custom Webcam Streaming Service
After=multi-user.target

[Service]
Type=simple
ExecStart=/home/pi/Webcam_Record/vlc_webcam_stream_service.sh
Restart=on-abort

[Install]
WantedBy=multi-user.target
sudo chmod 644 /lib/systemd/system/webcam-stream.service
chmod +x /home/pi/Webcam_Record/vlc_webcam_stream.sh
sudo sed -i 's/geteuid/getppid/' /usr/bin/vlc
sudo systemctl daemon-reload
sudo systemctl enable webcam-stream.service
sudo service webcam-stream status
sudo service webcam-stream start
#!/bin/bash
# auto stream launch + led off
#cvlc -vvv for verbose debug

# adapt to video device name
deviceNb=1

# loop duration
duration=15

#infinite recording
#loopOption=
loopOption=--loop

# force video format + led off
v4l2-ctl -d ${deviceNb} --set-fmt-video=width=1920,height=1080,pixelformat=1 --set-ctrl=led1_mode=0

# if delay needed :live-caching=2500
cvlc --sout-file-format --run-time=${duration} ${loopOption} v4l2:///dev/video${deviceNb}:chroma=h264 :input-slave=alsa://hw:1,0 --sout '#transcode{acodec=mpga,ab=128,channels=2,samplerate=44100,threads=4,audio-sync=1}:duplicate{dst=standard{access=file,mux=mp4,dst='/home/pi/Webcam_Record/%F_%T_Spy.mp4'}:dst=standard{access=http,mux=ts,mime=video/ts,dst=:8099}'
./my_vlc_webcam_script.sh | at 1400
VLC media player 2.2.6 Umbrella (revision 2.2.6-0-g1aae78981c)
[00acb230] pulse audio output error: PulseAudio server connection failure: Connection refused
cvlc -A alsa,none --alsa-audio-device default
Related Posts Related QUESTIONS :
  • Make web service not accessible by browser?
  • Select DOM elements within template
  • How to customize angular ui-grid row background color?
  • Binding data in two respective $scope in AngularJS, how?
  • react put some props after import class
  • Variable is distributed among same components
  • switch class in jQuery/JavaScript for active/inactive state
  • How To Track Outbound Clicks Using Javascript
  • How to get total seconds elapsed since the beginning of the month?
  • Protractor: Stale element reference at "browser.wait(EC.visibilityOf(confDial), FIFTY_SECONDS);"
  • Access to an array inside an object
  • Reseting an JavaScript Interval with different value?
  • Learning Angular for the first time - version 2 or 4?
  • Rendering RSS feed (XML) in React with jquery, why do object values parsed from the feed seem empty?
  • Node.js xml2js http.request tag matching
  • applying texture to custom plane geometry in Threejs
  • How do I pass an Event as a function parameter in HTML written inside JavaScript variable?
  • Interface of object parameter with default value and default property
  • Does using try / catch rather than `.catch` observable operator with XHR requests reduce performance?
  • In IE11 background colors not working on printing
  • TypeScript interface signature "(): string"
  • Is synchronous XMLHttpRequest supported in Internet Explorer 10 and 11?
  • Axios function not returning any values with js
  • How to use firestore TIMESTAMP to create time-stamp in JavaScript
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked
  • Is there value in propTypeing repeat required properties at every level of nested components?
  • Call function if variable does not exist in a filter
  • localStorage value doesn't get updated automatically
  • React not updating state with setState correctly inside promises
  • Direct native JavaScript or jQuery method to get containing block of an element
  • Dynamic JSON object to Html Table
  • How to send Id and file to same controller?
  • How to Make a jQuery Table Cell(td) clickable to Run a Function?
  • Prevent the duplicate function onchange event jQuery
  • Reactjs Input Upload doesn't return local URL
  • An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected
  • How to filter a JSON Array, with an eventListener input value at keyup
  • How to separate the different properties of filter in css?
  • Why dont work change event of bootstrap input spinner?
  • How to hide overflow text content in react
  • Is there another way to write line 6
  • Cypress - how to find by text content?
  • How to setstate for the dynamic checkboxes in a loop in react?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com