Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (85)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (8803)

  • 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;

  • How to mirror swscale PIX_FMT_YUYV422

    31 janvier 2012, par superg

    I'm trying to mirror libswscale PIX_FMT_YUYV422-type image horizontally. Using simple loop for each line with 16-bits per pixel results in having colors wrong, for example blue objects are orange. Here is my code :

      typedef unsigned short YUVPixel; // 16 bits per pixel
       for (int y = 0; y &lt; outHeight; y++)
       {
           YUVPixel *p1 = (YUVPixel*)pBits + y * outWidth;
           YUVPixel *p2 = p1 + outWidth - 1;
           for (int x = 0; x &lt; outWidth/2; x++) // outWidth is image width in pixels
           {
               // packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
               unsigned short tmp;
               tmp = *p1;
               *p1 = *p2;
               *p2 = tmp;
           }
       }

    Then I tried redefining YUVPixel as 32-bit type and modifying my loop accordingly. This results in correct colors, but looks like neighboring pixels are swapped. Any ideas, I'm totally lost with this ?

  • r210enc.c : Simplify and never store more than 10 bits.

    27 décembre 2014, par Reimar Döffinger
    r210enc.c : Simplify and never store more than 10 bits.
    

    The r10k and avrp decoders would previously store 12 bit precision
    for the blue channel, which is inconsistent and probably not a
    desirable behaviour.
    Now the 2 unused extra bits are set to 0.
    This is possibly not ideal either as RGBA1010102 format has the same
    layout but stores alpha in these bits, thus explicitly setting them
    to 1 might be preferable.

    Signed-off-by : Reimar Döffinger <Reimar.Doeffinger@gmx.de>

    • [DH] libavcodec/r210enc.c