Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (2)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

Sur d’autres sites (3012)

  • Record video stream in rust

    19 novembre 2024, par El_Loco

    I have bought a stereo camera with global shutter and a frame rate of at most 120 fps. https://www.amazon.com/dp/B0D8T3ZSL4?ref_=pe_386300_442618370_TE_sc_as_ri_0#

    


    My next step is to write a program that can show and record a video with desired fps and resolution.

    


    use opencv::{&#xA;    core, highgui,&#xA;    prelude::*,&#xA;    videoio::{self, VideoCapture},&#xA;    Result,&#xA;};&#xA;&#xA;fn open_camera() -> Result<videocapture> {&#xA;    let capture = videoio::VideoCapture::new(2, videoio::CAP_ANY)?;&#xA;    return Ok(capture);&#xA;}&#xA;fn main() -> Result&lt;()> {&#xA;    let window = "video capture";&#xA;    highgui::named_window(window, highgui::WINDOW_AUTOSIZE)?;&#xA;    let mut cam = open_camera()?;&#xA;    let opened = videoio::VideoCapture::is_opened(&amp;cam)?;&#xA;    if !opened {&#xA;        panic!("Unable to open default camera!");&#xA;    }&#xA;    let width = 3200.0;&#xA;    let height = 1200.0;&#xA;    cam.set(videoio::CAP_PROP_FRAME_WIDTH, width)?;&#xA;    cam.set(videoio::CAP_PROP_FRAME_HEIGHT, height)?;&#xA;&#xA;    // Set the frame rate (FPS)&#xA;    let fps = 60.0;&#xA;        &#xA;    let fourcc = videoio::VideoWriter::fourcc(&#x27;M&#x27;, &#x27;J&#x27;, &#x27;P&#x27;, &#x27;G&#x27;)?;&#xA;    let mut writer = videoio::VideoWriter::new(&#xA;        "video_output.avi",&#xA;        fourcc,&#xA;        fps,&#xA;        core::Size::new(width as i32, height as i32),&#xA;        true,&#xA;    )?;&#xA;&#xA;    if !writer.is_opened()? {&#xA;        println!("Error: Could not open the video writer.");&#xA;    }&#xA;&#xA;    let mut frame = core::Mat::default();&#xA;    let mut ctr = 0;&#xA;    while cam.read(&amp;mut frame)? {&#xA;        if frame.empty() {&#xA;            break;&#xA;        }&#xA;        writer.write(&amp;frame)?;&#xA;        highgui::imshow(window, &amp;frame)?;&#xA;        &#xA;        let key = highgui::wait_key(1)?;&#xA;        if key > 0 {&#xA;            break;&#xA;        }&#xA;        ctr &#x2B;= 1;&#xA;        if ctr == 600 {&#xA;            break;&#xA;        }&#xA;    }&#xA;    cam.release()?;&#xA;    writer.release()?;&#xA;    Ok(())&#xA;}&#xA;</videocapture>

    &#xA;

    When I run this code the frame rate is terrible. Like 1 fps or something. For debugging I tried to run in cheese. There I got 30 fps with full resolution 3200x1200. But I cannot change the fps to 60 fps what I can see.

    &#xA;

    Then I tried to capture a video using ffmpeg :

    &#xA;

    ffmpeg -f v4l2 -framerate 60 -video_size 3200x1200 -i /dev/video2 output.mp4

    &#xA;

    With the following output :

    &#xA;

    [video4linux2,v4l2 @ 0x5a72cbbd1400] The driver changed the time per frame from 1/60 to 1/2&#xA;Input #0, video4linux2,v4l2, from &#x27;/dev/video2&#x27;:&#xA;  Duration: N/A, start: 2744.250608, bitrate: 122880 kb/s&#xA;  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 3200x1200, 122880 kb/s, 2 fps, 2 tbr, 1000k tbn&#xA;File &#x27;output.mp4&#x27; already exists. Overwrite? [y/N]&#xA;

    &#xA;

    The frame rate is lowered to 2 fps.

    &#xA;

    Then I tried to run v4l2-ctl --list-formats-ext -d 2 with the following output :

    &#xA;

    ioctl: VIDIOC_ENUM_FMT&#xA;        Type: Video Capture&#xA;&#xA;        [0]: &#x27;MJPG&#x27; (Motion-JPEG, compressed)&#xA;                Size: Discrete 3200x1200&#xA;                        Interval: Discrete 0.017s (60.000 fps)&#xA;                        Interval: Discrete 0.033s (30.000 fps)&#xA;                        Interval: Discrete 0.040s (25.000 fps)&#xA;                        Interval: Discrete 0.050s (20.000 fps)&#xA;                        Interval: Discrete 0.067s (15.000 fps)&#xA;                        Interval: Discrete 0.100s (10.000 fps)&#xA;                Size: Discrete 2560x720&#xA;                        Interval: Discrete 0.017s (60.000 fps)&#xA;                        Interval: Discrete 0.033s (30.000 fps)&#xA;                        Interval: Discrete 0.040s (25.000 fps)&#xA;                        Interval: Discrete 0.050s (20.000 fps)&#xA;                        Interval: Discrete 0.067s (15.000 fps)&#xA;                        Interval: Discrete 0.100s (10.000 fps)&#xA;                Size: Discrete 1600x600&#xA;                        Interval: Discrete 0.008s (120.000 fps)&#xA;                        Interval: Discrete 0.017s (60.000 fps)&#xA;                        Interval: Discrete 0.033s (30.000 fps)&#xA;                        Interval: Discrete 0.040s (25.000 fps)&#xA;                        Interval: Discrete 0.050s (20.000 fps)&#xA;                        Interval: Discrete 0.067s (15.000 fps)&#xA;

    &#xA;

    I then tried to open the camera using qv4land there it seemed to work. Does not seem like I can record a video though.

    &#xA;

    I am using Rust to learn. I want to be able to programmatically be able to record a video somehow and then do computer vision. The easiest would be to do it in Rust. But other solutions are ok.

    &#xA;

    Edit&#xA;I have found some more this morning :

    &#xA;

    v4l2-ctl -d 2 --list-formats-ext&#xA;ioctl: VIDIOC_ENUM_FMT&#xA;    Type: Video Capture&#xA;&#xA;    [0]: &#x27;MJPG&#x27; (Motion-JPEG, compressed)&#xA;        Size: Discrete 3200x1200&#xA;            Interval: Discrete 0.017s (60.000 fps)&#xA;            Interval: Discrete 0.033s (30.000 fps)&#xA;            Interval: Discrete 0.040s (25.000 fps)&#xA;            Interval: Discrete 0.050s (20.000 fps)&#xA;            Interval: Discrete 0.067s (15.000 fps)&#xA;            Interval: Discrete 0.100s (10.000 fps)&#xA;&#xA;    [1]: &#x27;YUYV&#x27; (YUYV 4:2:2)&#xA;        Size: Discrete 3200x1200&#xA;            Interval: Discrete 0.500s (2.000 fps)&#xA;        Size: Discrete 2560x720&#xA;            Interval: Discrete 0.500s (2.000 fps)&#xA;        Size: Discrete 1600x600&#xA;            Interval: Discrete 0.100s (10.000 fps)&#xA;

    &#xA;

    I also found here that order of flags was important for ffmpeg. Running this I can actually record a video with 60 fps :

    &#xA;

    ffmpeg -framerate 60 -f v4l2 -video_size 3200x1200 -input_format mjpeg  -i /dev/video2 output.avi

    &#xA;

    A drawback is that the images does not look very sharp. You can clearly see the pixels. (I am new to video formats etc as well. Before it has just worked.)

    &#xA;

    If I change from avito mkvit is slow again.

    &#xA;

    In the link above I also saw a suggestion to first do :

    &#xA;

    ffmpeg -framerate 60 -f v4l2 -video_size 3200x1200 -input_format mjpeg  -i /dev/video2 -c copy mjpeg.mkv

    &#xA;

    and then :

    &#xA;

    ffmpeg -i mjpeg.mkv -c:v libx264 -crf 23 -preset medium -pix_fmt yuv420p out.mkv

    &#xA;

    which worked. But I am not sure those flags are ideal for the camera I have. I think it is a good start to make it run as expected using command line and ffmpeg. So I know what format to use and that it actually works as intended before doing it programmatically.

    &#xA;

  • avformat/hls : Be more picky on extensions

    16 janvier, par Michael Niedermayer
    avformat/hls : Be more picky on extensions
    

    This blocks disallowed extensions from probing
    It also requires all available segments to have matching extensions to the format
    mpegts is treated independent of the extension

    It is recommended to set the whitelists correctly
    instead of depending on extensions, but this should help a bit,
    and this is easier to backport

    Fixes : CVE-2023-6602 II. HLS Force TTY Demuxer
    Fixes : CVE-2023-6602 IV. HLS XBIN Demuxer DoS Amplification

    The other parts of CVE-2023-6602 have been fixed by prior commits

    Found-by : Harvey Phillips of Amazon Element55 (element55)
    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] doc/demuxers.texi
    • [DH] libavformat/hls.c
  • Revision 30966 : eviter le moche ’doctype_ecrire’ lors de l’upgrade

    17 août 2009, par fil@… — Log

    eviter le moche ’doctype_ecrire’ lors de l’upgrade