
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (22)
-
List of compatible distributions
26 avril 2011, parThe 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 2011Unfortunately 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, parLorsque 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-fawzanThis 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 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'dart:convert';
import 'dart:typed_data';
import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;

void main() {
 runApp(MyApp());
}

class MyApp extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
 return MaterialApp(
 home: MyHomePage(),
 );
 }
}

class MyHomePage extends StatefulWidget {
 @override
 _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<myhomepage> {
 TextEditingController _textEditingController = TextEditingController();
 late stt.SpeechToText _speech;
 bool _isListening = false;

 @override
 void initState() {
 super.initState();
 _speech = stt.SpeechToText();
 }

 void _listen() async {
 if (!_isListening) {
 bool available = await _speech.initialize(
 onStatus: (val) => print('onStatus: $val'),
 onError: (val) => print('onError: $val'),
 );
 if (available) {
 setState(() => _isListening = true);
 _speech.listen(
 onResult: (val) => setState(() {
 _textEditingController.text = val.recognizedWords;
 if (val.hasConfidenceRating && val.confidence > 0) {
 _showImages(val.recognizedWords);
 }
 }),
 );
 }
 } else {
 setState(() => _isListening = false);
 _speech.stop();
 }
 }

 @override
 Widget build(BuildContext context) {
 return Scaffold(
 appBar: AppBar(
 title: Text('Image Viewer'),
 ),
 body: Padding(
 padding: const EdgeInsets.all(16.0),
 child: Column(
 mainAxisAlignment: MainAxisAlignment.center,
 children: [
 TextField(
 controller: _textEditingController,
 decoration: const InputDecoration(
 labelText: 'Enter a word',
 ),
 ),
 SizedBox(height: 16.0),
 ElevatedButton(
 onPressed: () {
 String userInput = _textEditingController.text;
 _showImages(userInput);
 },
 child: Text('Show Images'),
 ),
 SizedBox(height: 16.0),
 ElevatedButton(
 onPressed: _listen,
 child: Text(_isListening ? 'Stop Listening' : 'Start Listening'),
 ),
 ],
 ),
 ),
 );
 }

Future<void> _showImages(String userInput) async {
 String directoryPath = 'assets/output_images/';
 print("User Input: $userInput");
 print("Directory Path: $directoryPath");

 List<string> assetFiles = await rootBundle
 .loadString('AssetManifest.json')
 .then((String manifestContent) {
 final Map manifestMap = json.decode(manifestContent);
 return manifestMap.keys
 .where((String key) => key.startsWith(directoryPath))
 .toList();
 });

 List<string> imageFiles = assetFiles.where((String assetPath) =>
 assetPath.toLowerCase().endsWith('.jpg') ||
 assetPath.toLowerCase().endsWith('.gif')).toList();

 List<string> words = userInput.split(' '); // Tokenize the sentence into words

 for (String word in words) {
 String wordImagePath = '$directoryPath$word.gif';

 if (imageFiles.contains(wordImagePath)) {
 await _showDialogWithImage(wordImagePath);
 } else {
 for (int i = 0; i < word.length; i++) {
 String letter = word[i];
 String letterImagePath = imageFiles.firstWhere(
 (assetPath) => assetPath.toLowerCase().endsWith('$letter.jpg'),
 orElse: () => '',
 );
 if (letterImagePath.isNotEmpty) {
 await _showDialogWithImage(letterImagePath);
 } else {
 print('No image found for $letter');
 }
 }
 }
 }
}

 

 Future<void> _showDialogWithImage(String imagePath) async {
 await showDialog<void>(
 context: context,
 builder: (BuildContext context) {
 return AlertDialog(
 content: Image.asset(imagePath),
 actions: [
 TextButton(
 onPressed: () {
 Navigator.of(context).pop();
 },
 child: Text('Close'),
 ),
 TextButton(
 onPressed: () async {
 await _downloadImage(imagePath);
 Navigator.of(context).pop();
 },
 child: Text('Download'),
 ),
 ],
 );
 },
 );
 }

 Future<void> _downloadImage(String assetPath) async {
 try {
 final ByteData data = await rootBundle.load(assetPath);
 final List<int> bytes = data.buffer.asUint8List();

 final result = await ImageGallerySaver.saveImage(Uint8List.fromList(bytes));

 if (result != null) {
 ScaffoldMessenger.of(context).showSnackBar(
 SnackBar(
 content: Text('Image saved to gallery.'),
 ),
 );
 } else {
 ScaffoldMessenger.of(context).showSnackBar(
 SnackBar(
 content: Text('Failed to save image to gallery.'),
 ),
 );
 }
 } catch (e) {
 print('Error downloading image: $e');
 }
 }
}

</int></void></void></void></string></string></string></void></myhomepage>


-
I can't get my backend working with frontend in production but in local environment [duplicate]
3 août 2024, par YouareGrouseChrisThis is the frontend code :


import React, { useState } from 'react';
import axios from 'axios';
import fileDownload from 'js-file-download';

function HomePage() {
 const [url, setUrl] = useState('');
 const [filename, setFilename] = useState('');

 const handleSubmit = async (e) => {
 e.preventDefault();
 try {
 const response = await axios.post('https://api-lnp5.onrender.com/api/download', { url, filename }, { responseType: 'blob' });
 fileDownload(response.data, filename);
 console.log(response.data); // handle the response as needed
 } catch (error) {
 console.error(error);
 }
 };

 return (
 <div classname="flex flex-col items-center justify-center h-screen overflow-hidden">
 <h1 classname="text-3xl font-bold mb-6">Download Reddit video!!!</h1>
 <form classname="flex flex-col items-center">
 <label classname="mb-4">
 <div classname="text-lg mb-4 inline-block">Video URL:</div>
 <div>
 <input type="text" value="{url}" />> setUrl(e.target.value)} required 
 className="border px-3 py-2 rounded focus:outline-none focus:ring focus:border-blue-300 w-96"/>
 </div>
 </label>
 <label classname="mb-4">
 <div classname="text-lg mb-4 inline-block">Filename:</div>
 <div>
 <input type="text" value="{filename}" />> setFilename(e.target.value)} required 
 className="border px-3 py-2 rounded focus:outline-none focus:ring focus:border-blue-300 w-96"/>
 </div>
 </label>
 <button type="submit" classname="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Download</button>
 </form>
 </div>
 );
}

export default HomePage;



This is the backend code using python fastapi :


from fastapi import FastAPI, HTTPException

from fastapi.responses import FileResponse
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
import requests
import json
import subprocess
import os

app = FastAPI()

origins = [
 "https://videodownload-frontend.onrender.com", # replace with the origin of your frontend
]

app.add_middleware(
 CORSMiddleware,
 allow_origins=["*"],
 allow_credentials=True,
 allow_methods=["*"],
 allow_headers=["*"],
)

class Video(BaseModel):
 url: str
 filename: str


def get_unique_filename(filename):
 counter = 1
 base_filename, extension = os.path.splitext(filename)
 unique_filename = filename

 while os.path.isfile(unique_filename):
 unique_filename = f"{base_filename}({counter}){extension}"
 counter += 1

 return unique_filename

@app.post("/api/download")
async def download_video(video: Video):
 url = video.url
 filename = get_unique_filename(video.filename)

 url += '.json'
 response = requests.get(url, headers={'User-agent': 'Mozilla/5.0'})

 if response.status_code != 200:
 raise HTTPException(status_code=404, detail="Video not found")

 json_response = json.loads(response.text)
 video_url = json_response[0]["data"]["children"][0]["data"]["secure_media"]["reddit_video"]["fallback_url"]
 audio_url = video_url.rsplit('/', 1)[0] + '/DASH_audio.mp4'

 video_response = requests.get(video_url, stream=True)
 audio_response = requests.get(audio_url, stream=True)

 with open('video_temp.mp4', 'wb') as f:
 for chunk in video_response.iter_content(chunk_size=1024 * 1024):
 if chunk:
 f.write(chunk)
 if audio_response.status_code == 200:
 with open('audio_temp.mp4', 'wb') as f:
 for chunk in audio_response.iter_content(chunk_size=1024 * 1024):
 if chunk:
 f.write(chunk)
 subprocess.run(['ffmpeg', '-i', 'video_temp.mp4', '-i', 'audio_temp.mp4', '-c', 'copy', filename])
 else:
 os.rename('video_temp.mp4', filename)

 return FileResponse(filename, media_type='application/octet-stream', filename=filename)



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




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


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


Thank you !


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


-
what is the meaning of the v4l2-ctl —list-device ?
26 janvier 2021, par mcgregor94086The High level Problem :


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.


Can "v4l2-ctl —list_devices" help me ?


I am trying to determine if
"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.


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


Here is the output I get from v4l2-ctl :


$ v4l2-ctl --list-device 
bcm2835-codec-decode (platform:bcm2835-codec):
 /dev/video10
 /dev/video11
 /dev/video12

bcm2835-isp (platform:bcm2835-isp):
 /dev/video13
 /dev/video14
 /dev/video15
 /dev/video16

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.1.1):
 /dev/video4
 /dev/video5

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.1.2):
 /dev/video6
 /dev/video7

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.1.3):
 /dev/video8
 /dev/video9

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.1.4):
 /dev/video17
 /dev/video18

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.2):
 /dev/video0
 /dev/video1

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.2.3):
 /dev/video2
 /dev/video3

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.1.1):
 /dev/video21
 /dev/video22

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.1.2):
 /dev/video25
 /dev/video26

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.1.4):
 /dev/video29
 /dev/video30

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.2):
 /dev/video19
 /dev/video20

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.3):
 /dev/video23
 /dev/video24

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.1.3.4):
 /dev/video27
 /dev/video28

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.1.2):
 /dev/video35
 /dev/video36

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.1.3):
 /dev/video39
 /dev/video40

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.1.4):
 /dev/video41
 /dev/video42

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.2):
 /dev/video31
 /dev/video32

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.3):
 /dev/video33
 /dev/video34

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.2.4):
 /dev/video37
 /dev/video38

FHD Camera: FHD Camera (usb-0000:01:00.0-1.2.4.2):
 /dev/video43
 /dev/video44



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.


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.


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


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


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


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.


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


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



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.


My request :


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 ?


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


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


Addendum


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


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.


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.


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.


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.


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.


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.


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.


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.