Recherche avancée

Médias (91)

Autres articles (28)

  • Qualité du média après traitement

    21 juin 2013, par

    Le 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, par

    Pour 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, par

    MediaSPIP 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 YouareGrouseChris

    This is the frontend code :

    


    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;

  • Get all bytes of stream from webcam after being compressed by codec with ffmpeg ?

    26 octobre 2015, par vantrung -cuncon

    I 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 g13

    I 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 :

    enter image description here