
Recherche avancée
Médias (91)
-
Spitfire Parade - Crisis
15 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Wired NextMusic
14 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (28)
-
Qualité du média après traitement
21 juin 2013, parLe bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...) -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...)
Sur d’autres sites (4053)
-
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


-
Get all bytes of stream from webcam after being compressed by codec with ffmpeg ?
26 octobre 2015, par vantrung -cunconI need to capture every single byte of the video stream from webcam -after using commandline-ffmpeg to compress it with codec.
So can you please light me up with somewhat the ffmpeg commandline look like and the strategy to get the output stream into my program written by VB6 or VB.net ? (I need to manipulate with every single byte !) Highly appreciate any suggestion.
Update : I wonder if it’s possible to save the output as "avi" file on hard disk and at the same time use my program to read content of the saving file. Can I playback the "part of avi file" that I retrieve while the file is being saved (appended) ? Is there any better file format for writting & reading (recording & playing) at the same time other than "avi" ?
Or any better/faster solution ?
-
How to add padding on a video with text in foreground using ffmpeg
25 août 2016, par g13I want to add padding to video clip according to width and height of the text I input. The sentence should be able to break relative to video width automatically.
For padding I use :
ffmpeg -i d:\video.mp4 -vf pad=600:700:0:100:blue d:\videooutput.mp4
For text :
ffmpeg -i d:\videooutput.mp4 -vf "drawtext=fontfile=/windows/fonts/BebasNeue.otf:text='Sed felis eros, ornate ut cursus a, imperdiet sit amet purus.':fontsize=20:fontcolor=white:x=0:y=0" d:\videooutput2.mp4
How to do achieve this in a single command ?
The required result should be like this :