
Recherche avancée
Médias (1)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (54)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Menus personnalisés
14 novembre 2010, parMediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
Menus créés à l’initialisation du site
Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...) -
MediaSPIP Core : La Configuration
9 novembre 2010, parMediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)
Sur d’autres sites (5860)
-
Frames took with ELP camera has unknown pixel format at FHD ?
11 novembre 2024, par Marcel KoperaI'm trying to take a one frame ever x seconds from my usb camera. Name of the camera is : ELP-USBFHD06H-SFV(5-50).
Code is not 100% done yet, but I'm using it this way right now ↓ (
shot
fn is called frommain.py
in a loop)


import cv2
import subprocess

from time import sleep
from collections import namedtuple

from errors import *

class Camera:
 def __init__(self, cam_index, res_width, res_height, pic_format, day_time_exposure_ms, night_time_exposure_ms):
 Resolution = namedtuple("resolution", ["width", "height"])
 self.manual_mode(True)

 self.cam_index = cam_index
 self.camera_resolution = Resolution(res_width, res_height)
 self.picture_format = pic_format
 self.day_time_exposure_ms = day_time_exposure_ms
 self.night_time_exposure_ms = night_time_exposure_ms

 self.started: bool = False
 self.night_mode = False

 self.cap = cv2.VideoCapture(self.cam_index, cv2.CAP_V4L2)
 self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, self.camera_resolution.width)
 self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, self.camera_resolution.height)
 self.cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*self.picture_format))

 

 def start(self):
 sleep(1)
 if not self.cap.isOpened():
 return CameraCupError()

 self.set_exposure_time(self.day_time_exposure_ms)
 self.set_brightness(0)
 sleep(0.1)
 
 self.started = True



 def shot(self, picture_name, is_night):
 if not self.started:
 return InitializationError()

 self.configure_mode(is_night)

 # Clear buffer
 for _ in range(5):
 ret, _ = self.cap.read()

 ret, frame = self.cap.read()

 sleep(0.1)

 if ret:
 print(picture_name)
 cv2.imwrite(picture_name, frame)
 return True

 else:
 print("No photo")
 return False


 
 def release(self):
 self.set_exposure_time(156)
 self.set_brightness(0)
 self.manual_mode(False)
 self.cap.release()



 def manual_mode(self, switch: bool):
 if switch:
 subprocess.run(["v4l2-ctl", "--set-ctrl=auto_exposure=1"])
 else:
 subprocess.run(["v4l2-ctl", "--set-ctrl=auto_exposure=3"])
 sleep(1)

 
 
 def configure_mode(self, is_night):
 if is_night == self.night_mode:
 return

 if is_night:
 self.night_mode = is_night
 self.set_exposure_time(self.night_time_exposure_ms)
 self.set_brightness(64)
 else:
 self.night_mode = is_night
 self.set_exposure_time(self.day_time_exposure_ms)
 self.set_brightness(0)
 sleep(0.1)



 def set_exposure_time(self, ms: int):
 ms = int(ms)
 default_val = 156

 if ms < 1 or ms > 5000:
 ms = default_val

 self.cap.set(cv2.CAP_PROP_EXPOSURE, ms)



 def set_brightness(self, value: int):
 value = int(value)
 default_val = 0

 if value < -64 or value > 64:
 value = default_val

 self.cap.set(cv2.CAP_PROP_BRIGHTNESS, value)



Here are settings for the camera (yaml file)


camera:
 camera_index: 0
 res_width: 1920
 res_height: 1080
 picture_format: "MJPG"
 day_time_exposure_ms: 5
 night_time_exposure_ms: 5000
 photos_format: "jpg"




I do some configs like set manual mode for the camera, change exposure/brightness and saving frame.
Also the camera is probably catching the frames to the buffer (it is not saving latest frame in real time : it's more laggish), so I have to clear buffer every time. like this


# Clear buffer from old frames
 for _ in range(5):
 ret, _ = self.cap.read()
 
 # Get a new frame
 ret, frame = self.cap.read()



What I really don't like, but I could find a better way (tldr : setting buffer for 1 frame doesn't work on my camera).


Frames saved this method looks good with 1920x1080 resolution. BUT when I try to run
ffmpeg
command to make a timelapse from savedjpg
file like this

ffmpeg -framerate 20 -pattern_type glob -i "*.jpg" -c:v libx264 output.mp4



I got an error like this one


[image2 @ 0x555609c45240] Could not open file : 08:59:20.jpg
[image2 @ 0x555609c45240] Could not find codec parameters for stream 0 (Video: mjpeg, none(bt470bg/unknown/unknown)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, image2, from '*.jpg':
 Duration: 00:00:00.05, start: 0.000000, bitrate: N/A
 Stream #0:0: Video: mjpeg, none(bt470bg/unknown/unknown), 20 fps, 20 tbr, 20 tbn
Output #0, mp4, to 'output.mp4':
Output file #0 does not contain any stream



Also when I try to copy the files from Linux to Windows I get some weird copy failing error and option to skip the picture. But even when I press the skip button, the picture is copied and can be opened. I'm not sure what is wrong with the format, but the camera is supporting MPEG at 1920x1080.


>>> v4l2-ctl --all

Driver Info:
 Driver name : uvcvideo
 Card type : H264 USB Camera: USB Camera
 Bus info : usb-xhci-hcd.1-1
 Driver version : 6.6.51
 Capabilities : 0x84a00001
 Video Capture
 Metadata Capture
 Streaming
 Extended Pix Format
 Device Capabilities
 Device Caps : 0x04200001
 Video Capture
 Streaming
 Extended Pix Format
Media Driver Info:
 Driver name : uvcvideo
 Model : H264 USB Camera: USB Camera
 Serial : 2020032801
 Bus info : usb-xhci-hcd.1-1
 Media version : 6.6.51
 Hardware revision: 0x00000100 (256)
 Driver version : 6.6.51
Interface Info:
 ID : 0x03000002
 Type : V4L Video
Entity Info:
 ID : 0x00000001 (1)
 Name : H264 USB Camera: USB Camera
 Function : V4L2 I/O
 Flags : default
 Pad 0x0100000d : 0: Sink
 Link 0x0200001a: from remote pad 0x1000010 of entity 'Extension 4' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
 Width/Height : 1920/1080
 Pixel Format : 'MJPG' (Motion-JPEG)
 Field : None
 Bytes per Line : 0
 Size Image : 4147789
 Colorspace : sRGB
 Transfer Function : Default (maps to sRGB)
 YCbCr/HSV Encoding: Default (maps to ITU-R 601)
 Quantization : Default (maps to Full Range)
 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 Video Capture: crop_default, Left 0, Top 0, Width 1920, Height 1080, Flags:
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 1920, Height 1080, Flags:
Streaming Parameters Video Capture:
 Capabilities : timeperframe
 Frames per second: 15.000 (15/1)
 Read buffers : 0

User Controls

 brightness 0x00980900 (int) : min=-64 max=64 step=1 default=0 value=64
 contrast 0x00980901 (int) : min=0 max=64 step=1 default=32 value=32
 saturation 0x00980902 (int) : min=0 max=128 step=1 default=56 value=56
 hue 0x00980903 (int) : min=-40 max=40 step=1 default=0 value=0
 white_balance_automatic 0x0098090c (bool) : default=1 value=1
 gamma 0x00980910 (int) : min=72 max=500 step=1 default=100 value=100
 gain 0x00980913 (int) : min=0 max=100 step=1 default=0 value=0
 power_line_frequency 0x00980918 (menu) : min=0 max=2 default=1 value=1 (50 Hz)
 0: Disabled
 1: 50 Hz
 2: 60 Hz
 white_balance_temperature 0x0098091a (int) : min=2800 max=6500 step=1 default=4600 value=4600 flags=inactive
 sharpness 0x0098091b (int) : min=0 max=6 step=1 default=3 value=3
 backlight_compensation 0x0098091c (int) : min=0 max=2 step=1 default=1 value=1

Camera Controls

 auto_exposure 0x009a0901 (menu) : min=0 max=3 default=3 value=1 (Manual Mode)
 1: Manual Mode
 3: Aperture Priority Mode
 exposure_time_absolute 0x009a0902 (int) : min=1 max=5000 step=1 default=156 value=5000
 exposure_dynamic_framerate 0x009a0903 (bool) : default=0 value=0



I also tried to save the picture using
ffmpeg
in a case something is not right withopencv
like this :

ffmpeg -f v4l2 -framerate 30 -video_size 1920x1080 -i /dev/video0 -c:v libx264 -preset fast -crf 23 -t 00:01:00 output.mp4




It is saving the picture but also changing its format


[video4linux2,v4l2 @ 0x555659ed92b0] The V4L2 driver changed the video from 1920x1080 to 800x600
[video4linux2,v4l2 @ 0x555659ed92b0] The driver changed the time per frame from 1/30 to 1/15



But the format looks right when set it back to FHD using
v4l2



>>> v4l2-ctl --device=/dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=MJPG
>>> v4l2-ctl --get-fmt-video

Format Video Capture:
 Width/Height : 1920/1080
 Pixel Format : 'MJPG' (Motion-JPEG)
 Field : None
 Bytes per Line : 0
 Size Image : 4147789
 Colorspace : sRGB
 Transfer Function : Default (maps to sRGB)
 YCbCr/HSV Encoding: Default (maps to ITU-R 601)
 Quantization : Default (maps to Full Range)
 Flags :



I'm not sure what could be wrong with the format/camera and I don't think I have enough information to figure it out.


I tried to use
ffmpeg
instead ofopencv
and also change a few settings inopencv's cup
config.

-
Revision be6aeadaf4 : Try again to merge branch 'frame-parallel' into master branch. In frame paralle
27 janvier 2015, par hkuangChanged Paths :
Modify /test/decode_test_driver.cc
Modify /test/test-data.mk
Modify /test/test-data.sha1
Modify /test/test.mk
Modify /test/test_vector_test.cc
Modify /test/test_vectors.cc
Modify /test/vp9_encoder_parms_get_to_decoder.cc
Add /test/vp9_frame_parallel_test.cc
Modify /test/webm_video_source.h
Modify /vp9/common/vp9_alloccommon.c
Modify /vp9/common/vp9_alloccommon.h
Modify /vp9/common/vp9_entropymode.c
Modify /vp9/common/vp9_mvref_common.c
Modify /vp9/common/vp9_mvref_common.h
Modify /vp9/common/vp9_onyxc_int.h
Modify /vp9/common/vp9_reconinter.c
Modify /vp9/common/vp9_reconinter.h
Modify /vp9/decoder/vp9_decodeframe.c
Modify /vp9/decoder/vp9_decodeframe.h
Modify /vp9/decoder/vp9_decodemv.c
Modify /vp9/decoder/vp9_decodemv.h
Modify /vp9/decoder/vp9_decoder.c
Modify /vp9/decoder/vp9_decoder.h
Add /vp9/decoder/vp9_dthread.c
Add /vp9/decoder/vp9_dthread.h
Modify /vp9/encoder/vp9_encoder.c
Modify /vp9/encoder/vp9_encoder.h
Modify /vp9/encoder/vp9_firstpass.c
Modify /vp9/encoder/vp9_pickmode.c
Modify /vp9/encoder/vp9_rd.c
Modify /vp9/encoder/vp9_rdopt.c
Modify /vp9/vp9_cx_iface.c
Modify /vp9/vp9_dx_iface.c
Modify /vp9/vp9dx.mk
Modify /vpx/vpx_frame_buffer.h
Modify /webmdec.cc
Modify /webmdec.h
Try again to merge branch ’frame-parallel’ into master branch.In frame parallel decode, libvpx decoder decodes several frames on all
cpus in parallel fashion. If not being flushed, it will only return frame
when all the cpus are busy. If getting flushed, it will return all the
frames in the decoder. Compare with current serial decode mode in which
libvpx decoder is idle between decode calls, libvpx decoder is busy
between decode calls.Current frame parallel decode will only speed up the decoding for frame
parallel encoded videos. For non frame parallel encoded videos, frame
parallel decode is slower than serial decode due to lack of loopfilter
worker thread.There are still some known issues that need to be addressed. For example :
decode frame parallel videos with segmentation enabled is not right sometimes.* frame-parallel :
Add error handling for frame parallel decode and unit test for that.
Fix a bug in frame parallel decode and add a unit test for that.
Add two test vectors to test frame parallel decode.
Add key frame seeking to webmdec and webm_video_source.
Implement frame parallel decode for VP9.
Increase the thread test range to cover 5, 6, 7, 8 threads.
Fix a bug in adding frame parallel unit test.
Add VP9 frame-parallel unit test.
Manually pick "Make the api behavior conform to api spec." from master branch.
Move vp9_dec_build_inter_predictors_* to decoder folder.
Add segmentation map array for current and last frame segmentation.
Include the right header for VP9 worker thread.
Move vp9_thread.* to common.
ctrl_get_reference does not need user_priv.
Seperate the frame buffers from VP9 encoder/decoder structure.
Revert "Revert "Revert "Revert 3 patches from Hangyu to get Chrome to
build :"""
Conflicts :
test/codec_factory.h
test/decode_test_driver.cc
test/decode_test_driver.h
test/invalid_file_test.cc
test/test-data.sha1
test/test.mk
test/test_vectors.cc
vp8/vp8_dx_iface.c
vp9/common/vp9_alloccommon.c
vp9/common/vp9_entropymode.c
vp9/common/vp9_loopfilter_thread.c
vp9/common/vp9_loopfilter_thread.h
vp9/common/vp9_mvref_common.c
vp9/common/vp9_onyxc_int.h
vp9/common/vp9_reconinter.c
vp9/decoder/vp9_decodeframe.c
vp9/decoder/vp9_decodeframe.h
vp9/decoder/vp9_decodemv.c
vp9/decoder/vp9_decoder.c
vp9/decoder/vp9_decoder.h
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_pickmode.c
vp9/encoder/vp9_rdopt.c
vp9/vp9_cx_iface.c
vp9/vp9_dx_iface.cThis reverts commit a18da9760a74d9ce6fb9f875706dc639c95402f5.
Change-Id : I361442ffec1586d036ea2e0ee97ce4f077585f02
-
Specify timestamp in ffmpeg video segment command
12 mai 2015, par SoumyaI have a continuous RTSP stream coming from a camera over the network.
I want to dump the stream but in video files of length 1 min each.I an using the following command
ffmpeg -i "rtsp://user:pass@example.com" -f mp4 -r 12 -s 640x480 -ar 44100 \
-ac 1 -segment_time 60 -segment_format mp4 "out%03d.mp4"The name of the files being created are of the form
out001.mp4
,out002.mp4
, etc.I want to include the timestamp (hour and minute) in the name of the file segments eg.
09-30.mp4
,09-31.mp4
, etc.If it is mandatory to provide a serial number for the segment, is it possible to get something like
09-30-001.mp4
,09-31-002
.mp4 ?