Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (22)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Création définitive du canal

    12 mars 2010, par

    Lorsque votre demande est validée, vous pouvez alors procéder à la création proprement dite du canal. Chaque canal est un site à part entière placé sous votre responsabilité. Les administrateurs de la plateforme n’y ont aucun accès.
    A la validation, vous recevez un email vous invitant donc à créer votre canal.
    Pour ce faire il vous suffit de vous rendre à son adresse, dans notre exemple "http://votre_sous_domaine.mediaspip.net".
    A ce moment là un mot de passe vous est demandé, il vous suffit d’y (...)

Sur d’autres sites (3266)

  • Is there a way to program the (Download) button to save a group of images as a one video ?

    9 février 2024, par Lina Al-fawzan

    This is my entire code. Its function is that everything the user writes or says will have images returned to him according to what he wrote/said, and the next image will be shown to him after he presses “close,” and he can save each image separately. I want to make a simple modification to it. First, instead of a close button, I want each image to be displayed for 3 seconds and the next one to be displayed, and so on... “all of them in one window”, and for the “download” button to be when the last image is displayed, and for them all to be saved in one video.

    


    import &#x27;package:flutter/material.dart&#x27;;&#xA;import &#x27;package:flutter/services.dart&#x27; show rootBundle;&#xA;import &#x27;dart:convert&#x27;;&#xA;import &#x27;dart:typed_data&#x27;;&#xA;import &#x27;package:image_gallery_saver/image_gallery_saver.dart&#x27;;&#xA;import &#x27;package:speech_to_text/speech_to_text.dart&#x27; as stt;&#xA;&#xA;void main() {&#xA;  runApp(MyApp());&#xA;}&#xA;&#xA;class MyApp extends StatelessWidget {&#xA;  @override&#xA;  Widget build(BuildContext context) {&#xA;    return MaterialApp(&#xA;      home: MyHomePage(),&#xA;    );&#xA;  }&#xA;}&#xA;&#xA;class MyHomePage extends StatefulWidget {&#xA;  @override&#xA;  _MyHomePageState createState() => _MyHomePageState();&#xA;}&#xA;&#xA;class _MyHomePageState extends State<myhomepage> {&#xA;  TextEditingController _textEditingController = TextEditingController();&#xA;  late stt.SpeechToText _speech;&#xA;  bool _isListening = false;&#xA;&#xA;  @override&#xA;  void initState() {&#xA;    super.initState();&#xA;    _speech = stt.SpeechToText();&#xA;  }&#xA;&#xA;  void _listen() async {&#xA;    if (!_isListening) {&#xA;      bool available = await _speech.initialize(&#xA;        onStatus: (val) => print(&#x27;onStatus: $val&#x27;),&#xA;        onError: (val) => print(&#x27;onError: $val&#x27;),&#xA;      );&#xA;      if (available) {&#xA;        setState(() => _isListening = true);&#xA;        _speech.listen(&#xA;          onResult: (val) => setState(() {&#xA;            _textEditingController.text = val.recognizedWords;&#xA;            if (val.hasConfidenceRating &amp;&amp; val.confidence > 0) {&#xA;              _showImages(val.recognizedWords);&#xA;            }&#xA;          }),&#xA;        );&#xA;      }&#xA;    } else {&#xA;      setState(() => _isListening = false);&#xA;      _speech.stop();&#xA;    }&#xA;  }&#xA;&#xA;  @override&#xA;  Widget build(BuildContext context) {&#xA;    return Scaffold(&#xA;      appBar: AppBar(&#xA;        title: Text(&#x27;Image Viewer&#x27;),&#xA;      ),&#xA;      body: Padding(&#xA;        padding: const EdgeInsets.all(16.0),&#xA;        child: Column(&#xA;          mainAxisAlignment: MainAxisAlignment.center,&#xA;          children: [&#xA;            TextField(&#xA;              controller: _textEditingController,&#xA;              decoration: const InputDecoration(&#xA;                labelText: &#x27;Enter a word&#x27;,&#xA;              ),&#xA;            ),&#xA;            SizedBox(height: 16.0),&#xA;            ElevatedButton(&#xA;              onPressed: () {&#xA;                String userInput = _textEditingController.text;&#xA;                _showImages(userInput);&#xA;              },&#xA;              child: Text(&#x27;Show Images&#x27;),&#xA;            ),&#xA;            SizedBox(height: 16.0),&#xA;            ElevatedButton(&#xA;              onPressed: _listen,&#xA;              child: Text(_isListening ? &#x27;Stop Listening&#x27; : &#x27;Start Listening&#x27;),&#xA;            ),&#xA;          ],&#xA;        ),&#xA;      ),&#xA;    );&#xA;  }&#xA;&#xA;Future<void> _showImages(String userInput) async {&#xA;  String directoryPath = &#x27;assets/output_images/&#x27;;&#xA;  print("User Input: $userInput");&#xA;  print("Directory Path: $directoryPath");&#xA;&#xA;  List<string> assetFiles = await rootBundle&#xA;      .loadString(&#x27;AssetManifest.json&#x27;)&#xA;      .then((String manifestContent) {&#xA;    final Map manifestMap = json.decode(manifestContent);&#xA;    return manifestMap.keys&#xA;        .where((String key) => key.startsWith(directoryPath))&#xA;        .toList();&#xA;  });&#xA;&#xA;  List<string> imageFiles = assetFiles.where((String assetPath) =>&#xA;      assetPath.toLowerCase().endsWith(&#x27;.jpg&#x27;) ||&#xA;      assetPath.toLowerCase().endsWith(&#x27;.gif&#x27;)).toList();&#xA;&#xA;  List<string> words = userInput.split(&#x27; &#x27;); // Tokenize the sentence into words&#xA;&#xA;  for (String word in words) {&#xA;    String wordImagePath = &#x27;$directoryPath$word.gif&#x27;;&#xA;&#xA;    if (imageFiles.contains(wordImagePath)) {&#xA;      await _showDialogWithImage(wordImagePath);&#xA;    } else {&#xA;      for (int i = 0; i &lt; word.length; i&#x2B;&#x2B;) {&#xA;        String letter = word[i];&#xA;        String letterImagePath = imageFiles.firstWhere(&#xA;          (assetPath) => assetPath.toLowerCase().endsWith(&#x27;$letter.jpg&#x27;),&#xA;          orElse: () => &#x27;&#x27;,&#xA;        );&#xA;        if (letterImagePath.isNotEmpty) {&#xA;          await _showDialogWithImage(letterImagePath);&#xA;        } else {&#xA;          print(&#x27;No image found for $letter&#x27;);&#xA;        }&#xA;      }&#xA;    }&#xA;  }&#xA;}&#xA;&#xA;  &#xA;&#xA;  Future<void> _showDialogWithImage(String imagePath) async {&#xA;    await showDialog<void>(&#xA;      context: context,&#xA;      builder: (BuildContext context) {&#xA;        return AlertDialog(&#xA;          content: Image.asset(imagePath),&#xA;          actions: [&#xA;            TextButton(&#xA;              onPressed: () {&#xA;                Navigator.of(context).pop();&#xA;              },&#xA;              child: Text(&#x27;Close&#x27;),&#xA;            ),&#xA;            TextButton(&#xA;              onPressed: () async {&#xA;                await _downloadImage(imagePath);&#xA;                Navigator.of(context).pop();&#xA;              },&#xA;              child: Text(&#x27;Download&#x27;),&#xA;            ),&#xA;          ],&#xA;        );&#xA;      },&#xA;    );&#xA;  }&#xA;&#xA;  Future<void> _downloadImage(String assetPath) async {&#xA;    try {&#xA;      final ByteData data = await rootBundle.load(assetPath);&#xA;      final List<int> bytes = data.buffer.asUint8List();&#xA;&#xA;      final result = await ImageGallerySaver.saveImage(Uint8List.fromList(bytes));&#xA;&#xA;      if (result != null) {&#xA;        ScaffoldMessenger.of(context).showSnackBar(&#xA;          SnackBar(&#xA;            content: Text(&#x27;Image saved to gallery.&#x27;),&#xA;          ),&#xA;        );&#xA;      } else {&#xA;        ScaffoldMessenger.of(context).showSnackBar(&#xA;          SnackBar(&#xA;            content: Text(&#x27;Failed to save image to gallery.&#x27;),&#xA;          ),&#xA;        );&#xA;      }&#xA;    } catch (e) {&#xA;      print(&#x27;Error downloading image: $e&#x27;);&#xA;    }&#xA;  }&#xA;}&#xA;&#xA;</int></void></void></void></string></string></string></void></myhomepage>

    &#xA;

  • I can't get my backend working with frontend in production but in local environment [duplicate]

    3 août 2024, par YouareGrouseChris

    This is the frontend code :

    &#xA;

    import React, { useState } from &#x27;react&#x27;;&#xA;import axios from &#x27;axios&#x27;;&#xA;import fileDownload from &#x27;js-file-download&#x27;;&#xA;&#xA;function HomePage() {&#xA;    const [url, setUrl] = useState(&#x27;&#x27;);&#xA;    const [filename, setFilename] = useState(&#x27;&#x27;);&#xA;&#xA;    const handleSubmit = async (e) => {&#xA;        e.preventDefault();&#xA;        try {&#xA;            const response = await axios.post(&#x27;https://api-lnp5.onrender.com/api/download&#x27;, { url, filename }, { responseType: &#x27;blob&#x27; });&#xA;            fileDownload(response.data, filename);&#xA;            console.log(response.data);  // handle the response as needed&#xA;        } catch (error) {&#xA;            console.error(error);&#xA;        }&#xA;    };&#xA;&#xA;    return (&#xA;        <div classname="flex flex-col items-center justify-center h-screen overflow-hidden">&#xA;            <h1 classname="text-3xl font-bold mb-6">Download Reddit video!!!</h1>&#xA;            <form classname="flex flex-col items-center">&#xA;                <label classname="mb-4">&#xA;                    <div classname="text-lg mb-4 inline-block">Video URL:</div>&#xA;                    <div>&#xA;                        <input type="text" value="{url}" />> setUrl(e.target.value)} required &#xA;                            className="border px-3 py-2 rounded focus:outline-none focus:ring focus:border-blue-300 w-96"/>&#xA;                    </div>&#xA;                </label>&#xA;                <label classname="mb-4">&#xA;                    <div classname="text-lg mb-4 inline-block">Filename:</div>&#xA;                    <div>&#xA;                        <input type="text" value="{filename}" />> setFilename(e.target.value)} required &#xA;                            className="border px-3 py-2 rounded focus:outline-none focus:ring focus:border-blue-300 w-96"/>&#xA;                    </div>&#xA;                </label>&#xA;                <button type="submit" classname="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Download</button>&#xA;            </form>&#xA;        </div>&#xA;    );&#xA;}&#xA;&#xA;export default HomePage;&#xA;

    &#xA;

    This is the backend code using python fastapi :

    &#xA;

    from fastapi import FastAPI, HTTPException&#xA;&#xA;from fastapi.responses import FileResponse&#xA;from fastapi.middleware.cors import CORSMiddleware&#xA;from pydantic import BaseModel&#xA;import requests&#xA;import json&#xA;import subprocess&#xA;import os&#xA;&#xA;app = FastAPI()&#xA;&#xA;origins = [&#xA;    "https://videodownload-frontend.onrender.com",  # replace with the origin of your frontend&#xA;]&#xA;&#xA;app.add_middleware(&#xA;    CORSMiddleware,&#xA;    allow_origins=["*"],&#xA;    allow_credentials=True,&#xA;    allow_methods=["*"],&#xA;    allow_headers=["*"],&#xA;)&#xA;&#xA;class Video(BaseModel):&#xA;    url: str&#xA;    filename: str&#xA;&#xA;&#xA;def get_unique_filename(filename):&#xA;    counter = 1&#xA;    base_filename, extension = os.path.splitext(filename)&#xA;    unique_filename = filename&#xA;&#xA;    while os.path.isfile(unique_filename):&#xA;        unique_filename = f"{base_filename}({counter}){extension}"&#xA;        counter &#x2B;= 1&#xA;&#xA;    return unique_filename&#xA;&#xA;@app.post("/api/download")&#xA;async def download_video(video: Video):&#xA;    url = video.url&#xA;    filename = get_unique_filename(video.filename)&#xA;&#xA;    url &#x2B;= &#x27;.json&#x27;&#xA;    response = requests.get(url, headers={&#x27;User-agent&#x27;: &#x27;Mozilla/5.0&#x27;})&#xA;&#xA;    if response.status_code != 200:&#xA;        raise HTTPException(status_code=404, detail="Video not found")&#xA;&#xA;    json_response = json.loads(response.text)&#xA;    video_url = json_response[0]["data"]["children"][0]["data"]["secure_media"]["reddit_video"]["fallback_url"]&#xA;    audio_url = video_url.rsplit(&#x27;/&#x27;, 1)[0] &#x2B; &#x27;/DASH_audio.mp4&#x27;&#xA;&#xA;    video_response = requests.get(video_url, stream=True)&#xA;    audio_response = requests.get(audio_url, stream=True)&#xA;&#xA;    with open(&#x27;video_temp.mp4&#x27;, &#x27;wb&#x27;) as f:&#xA;        for chunk in video_response.iter_content(chunk_size=1024 * 1024):&#xA;            if chunk:&#xA;                f.write(chunk)&#xA;    if audio_response.status_code == 200:&#xA;        with open(&#x27;audio_temp.mp4&#x27;, &#x27;wb&#x27;) as f:&#xA;            for chunk in audio_response.iter_content(chunk_size=1024 * 1024):&#xA;                if chunk:&#xA;                    f.write(chunk)&#xA;        subprocess.run([&#x27;ffmpeg&#x27;, &#x27;-i&#x27;, &#x27;video_temp.mp4&#x27;, &#x27;-i&#x27;, &#x27;audio_temp.mp4&#x27;, &#x27;-c&#x27;, &#x27;copy&#x27;, filename])&#xA;    else:&#xA;        os.rename(&#x27;video_temp.mp4&#x27;, filename)&#xA;&#xA;    return FileResponse(filename, media_type=&#x27;application/octet-stream&#x27;, filename=filename)&#xA;

    &#xA;

    I deployed the fastapi by docker to Render. When I start the frontend development server, I could communicate with the backend without problems. But when I deployed both frontend and backend to Render, it shows always the CORS policy

    &#xA;

    enter image description here

    &#xA;

    Why is it ? if I could communicate with backend when starting local development server, it should be not related to backend.

    &#xA;

    This is URL to my frontend : https://videodownload-frontend.onrender.com/

    &#xA;

    Thank you !

    &#xA;

    I tried reconnect and restart the web service, also I tried to add CORS in fastapi. The api works fine with local server opened up. What should I do to debug ? thank you

    &#xA;

  • what is the meaning of the v4l2-ctl —list-device ?

    26 janvier 2021, par mcgregor94086

    The High level Problem :

    &#xA;

    I have a custom multi-camera array that I have attached to a Raspberry Pi via some USB hubs, and I need a way to quickly identify which camera needs attention when any camera fails to respond to an image capture request.

    &#xA;

    Can "v4l2-ctl —list_devices" help me ?

    &#xA;

    I am trying to determine if&#xA;"v4l2-ctl —list_devices" can help me more quickly identify which one is missing. My thought was to look at which cameras are reporting, and then notice which one is NOT reporting, and investigate the missing one.

    &#xA;

    My question is can I identify each reporting camera either for the v4l2-ctl output, or from "FFmpeg -list_formats"

    &#xA;

    Here is the output I get from v4l2-ctl :

    &#xA;

    $ v4l2-ctl --list-device            &#xA;bcm2835-codec-decode (platform:bcm2835-codec):&#xA;    /dev/video10&#xA;    /dev/video11&#xA;    /dev/video12&#xA;&#xA;bcm2835-isp (platform:bcm2835-isp):&#xA;    /dev/video13&#xA;    /dev/video14&#xA;    /dev/video15&#xA;    /dev/video16&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.1.1):&#xA;    /dev/video4&#xA;    /dev/video5&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.1.2):&#xA;    /dev/video6&#xA;    /dev/video7&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.1.3):&#xA;    /dev/video8&#xA;    /dev/video9&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.1.4):&#xA;    /dev/video17&#xA;    /dev/video18&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.2):&#xA;    /dev/video0&#xA;    /dev/video1&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.3):&#xA;    /dev/video2&#xA;    /dev/video3&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.1.1):&#xA;    /dev/video21&#xA;    /dev/video22&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.1.2):&#xA;    /dev/video25&#xA;    /dev/video26&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.1.4):&#xA;    /dev/video29&#xA;    /dev/video30&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.2):&#xA;    /dev/video19&#xA;    /dev/video20&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.3):&#xA;    /dev/video23&#xA;    /dev/video24&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.4):&#xA;    /dev/video27&#xA;    /dev/video28&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.1.2):&#xA;    /dev/video35&#xA;    /dev/video36&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.1.3):&#xA;    /dev/video39&#xA;    /dev/video40&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.1.4):&#xA;    /dev/video41&#xA;    /dev/video42&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.2):&#xA;    /dev/video31&#xA;    /dev/video32&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.3):&#xA;    /dev/video33&#xA;    /dev/video34&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.4):&#xA;    /dev/video37&#xA;    /dev/video38&#xA;&#xA;FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.4.2):&#xA;    /dev/video43&#xA;    /dev/video44&#xA;

    &#xA;

    All the USB cameras in my array each report the same first field (in this case "FHD Camera") so I can't use the name as a unique identifier.

    &#xA;

    Each "FHD Camera" is assigned two different /dev/videoNN ids (one will be assigned for the mpeg format, and the other for the UYV format). However these /dev/videoNN assignments change each time the computer reboots.

    &#xA;

    The sequence that cameras are listed in the output also changes each time the v4l2-ctl command runs. So that also is of no help

    &#xA;

    v4l2-ctl also reports another field, beginning "usb-0000 :" followed by a series numbers (e.g. "01:00.0-1.2.2.4").

    &#xA;

    I am wondering if this number string ties in any way to the physical USB bus, and would remain permanent across reboots.

    &#xA;

    The v4l2-ctl help documentation merely says that the —list-devices flag will list the video devices, but these additional fields and their meaning is not explained.

    &#xA;

    Alternatively, for each camera that is responding, I can query the device with&#xA;"ffmpeg -hide_banner -f v4l2 -list_formats all -i /dev/videoNN", yielding a response like this :

    &#xA;

    $ ffmpeg -hide_banner -f v4l2 -list_formats all -i /dev/video8&#xA;[video4linux2,v4l2 @ 0x1a391c0] Compressed:       mjpeg :          Motion-JPEG : 640x480 1280x720 640x360 320x240 1920x1080&#xA;[video4linux2,v4l2 @ 0x1a391c0] Raw       :     yuyv422 :           YUYV 4:2:2 : 640x480 1280x720 640x360 320x240 1920x1080&#xA;/dev/video8: Immediate exit requested&#xA;

    &#xA;

    This ffmpeg query shows me that the device is also registered as "0x1a391c0". I am not yet sure whether these identifiers are stable across reboots, and if they are, whether they are stable with the physical camera, or if they are just a stable identifier to the USB Hub location of the camera.

    &#xA;

    My request :

    &#xA;

    Can someone explain to me how the "device name", /dev/videoNN identifier, usb-0000:01:00.0-1.2.2.4 identifier, and 0x1a391c0 are assigned ?

    &#xA;

    The responding order of the items listed in v4l2-ctl changes each time it runs.

    &#xA;

    Is this reflecting that all cameras are polled simultaneously, but acquisition of the bus for response transmission is random ?

    &#xA;

    Addendum

    &#xA;

    Further investigation shows me that the "0x-------" identifiers do not seem to be stable across reboots either.

    &#xA;

    The "usb-0000:01:00.0-1.2.2.2" identifier DOES seem to have a somewhat stable meaning. I have (5) 7-port usb hubs attached to my RPi 400. 4 of these are branch hubs that feed into a master hub, and the master hub feeds into the RPi.

    &#xA;

    After the 0-1. in the identifier there is either 3 or 4 digits. If there are only 3, the last digit is a port identifier 2, 3, or 4.

    &#xA;

    If there are 4 digits, then the 2nd to last digit will be a 1, and 1.1, 1.2, 1.3, and 1.4 will represent the last 4 physical ports on that hub.

    &#xA;

    Ironically, while the same port identifiers are always used in the same order on each of my (identical brand/model) hubs, they are NOT in ascending or descending sequence in terms of their physical sequence on the hubs.

    &#xA;

    I have deduced from this that each of my hubs actually uses two USB 4 port chips. So the first chip is getting the single digits, while the 1st port on that 1st chip is feeding the 2nd chip.

    &#xA;

    The 2nd digit in my identifiers is identifying which branch hub the device is on, 1,2,3 or 4. The first digit is 1, which seems to be identifying that all the branches are children of the master hub.

    &#xA;

    These addresses seem to be stable across reboots as long as all of the USB hubs are already connected at boot up. If not all are connected, those that are connected first will get the lowest hub number identifiers.

    &#xA;

    I don't know if this tree address identifier behavior would be the same on other hubs, but perhaps these observations will be of some use to anyone else trying to find stable identifiers in their own multi hub and multi-device architecture.

    &#xA;