Recherche avancée

Médias (1)

Mot : - Tags -/punk

Autres articles (65)

  • 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 (...)

  • Emballe Médias : Mettre en ligne simplement des documents

    29 octobre 2010, par

    Le plugin emballe médias a été développé principalement pour la distribution mediaSPIP mais est également utilisé dans d’autres projets proches comme géodiversité par exemple. Plugins nécessaires et compatibles
    Pour fonctionner ce plugin nécessite que d’autres plugins soient installés : CFG Saisies SPIP Bonux Diogène swfupload jqueryui
    D’autres plugins peuvent être utilisés en complément afin d’améliorer ses capacités : Ancres douces Légendes photo_infos spipmotion (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (6080)

  • lavc/qsvdec : Use coded_w/h for frame resolution when use system memory

    20 mai 2024, par Fei Wang
    lavc/qsvdec : Use coded_w/h for frame resolution when use system memory
    

    Fix output mismatch when decode clip with crop(conf_win_*offset in
    syntax) info by using system memory :

    $ ffmpeg -c:v hevc_qsv -i conf_win_offet.bit -y out.yuv

    Signed-off-by : Fei Wang <fei.w.wang@intel.com>

    • [DH] libavcodec/qsvdec.c
  • avcodec/vvcdec : inter, wait reference with a different resolution

    19 mai 2024, par Nuo Mi
    avcodec/vvcdec : inter, wait reference with a different resolution
    

    For RPR, the current frame may reference a frame with a different resolution.
    Therefore, we need to consider frame scaling when we wait for reference pixels.

    • [DH] libavcodec/vvc/dec.c
    • [DH] libavcodec/vvc/dec.h
    • [DH] libavcodec/vvc/refs.c
    • [DH] libavcodec/vvc/thread.c
  • Setting up multiple resolution value in Fast API for transcoding uploaded video files

    23 janvier 2024, par Sanji Vinsmoke

    I created an API for transcoding video files like adaptive bit rate of youtube. I used Fast API. Currently, I am trying to set resolution values for each file. But whenever I am adding multiple resolutions, I am recieving "422 unprocessible entity" error in the Swagger.

    &#xA;

    Here is my code :

    &#xA;

    async def transcode_video(input_path, output_folder, res, unique_id, total_files, pbar):&#xA; # Use asyncio for command execution with progress bar&#xA; output_path = os.path.join(output_folder, f"{res}p.m3u8")&#xA;&#xA; # Calculate the target size&#xA; target_size = calculate_target_size(input_path)&#xA;&#xA; cmd_duration = f"ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 {input_path}"&#xA; total_duration = float(subprocess.check_output(cmd_duration, shell=True, text=True).strip())&#xA;&#xA; cmd = (&#xA;     f"ffmpeg -i {input_path} -vf scale=-2:{res} -c:a aac -b:a 128k "&#xA;     f"-g 50 -hls_time 1 -hls_list_size 0 "&#xA;     f"-crf 23 -b:v 100k -fs {target_size} "&#xA;     f"-hls_segment_filename \"{output_path.replace(&#x27;.m3u8&#x27;, &#x27;_%03d.ts&#x27;)}\" "&#xA;     f"{output_path}"&#xA; )&#xA;&#xA; process = await asyncio.create_subprocess_shell(&#xA;     cmd,&#xA;     stdout=asyncio.subprocess.PIPE,&#xA;     stderr=asyncio.subprocess.PIPE&#xA; )&#xA;&#xA; while True:&#xA;     line = await process.stderr.readline()&#xA;     if not line:&#xA;         break&#xA;     line = line.decode().strip()&#xA;     if "time=" in line:&#xA;         # Extracting the time progress from FFmpeg output&#xA;         time_str = line.split("time=")[1].split()[0]&#xA;         current_time = sum(x * float(t) for x, t in zip([3600, 60, 1], time_str.split(":")))&#xA;         progress = (current_time / total_duration) * 100&#xA;         pbar.update(progress - pbar.n)&#xA;&#xA; # Wait for the transcoding process to complete&#xA; await process.wait()&#xA;&#xA; if process.returncode != 0:&#xA;     raise HTTPException(status_code=500, detail="Video transcoding failed.")&#xA; pbar.close()&#xA;&#xA; # Increment the total number of transcoded files&#xA; total_files[0] &#x2B;= 1&#xA;&#xA;@app.post("/transcode/")&#xA;async def transcode_video_endpoint(files: List[UploadFile] = File(...), resolutions: List[int] = None):&#xA; # Counters for transcoded videos&#xA; total_files = [0]&#xA;&#xA; # Iterate over each file&#xA; for file in files:&#xA;     # Check if the file is a valid video file based on its extension&#xA;     valid_video_extensions = {".mp4", ".avi", ".mkv", ".mov", ".wmv", ".flv"}&#xA;     if not any(file.filename.lower().endswith(ext) for ext in valid_video_extensions):&#xA;         print(f"Skipping non-video file: {file.filename}")&#xA;         continue&#xA;&#xA;     # Assign a unique ID for each file&#xA;     unique_id = str(uuid.uuid4())&#xA;&#xA;     # Log the filename and unique ID&#xA;     print(f"Processing file: {file.filename} with unique ID: {unique_id}")&#xA;&#xA;     # Create a folder for the unique ID&#xA;     unique_id_folder = os.path.join(OUTPUT_FOLDER, unique_id)&#xA;     Path(unique_id_folder).mkdir(parents=True, exist_ok=True)&#xA;&#xA;     # Save the uploaded file&#xA;     input_path = os.path.join(UPLOAD_FOLDER, file.filename)&#xA;     with open(input_path, "wb") as video_file:&#xA;         video_file.write(file.file.read())&#xA;&#xA;     # Check if the file is a valid video file using ffprobe&#xA;     try:&#xA;         subprocess.run(&#xA;             ["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=codec_type", "-of", "csv=p=0", input_path],&#xA;             check=True, capture_output=True&#xA;         )&#xA;     except subprocess.CalledProcessError:&#xA;         print(f"Skipping non-video file: {file.filename}")&#xA;         continue&#xA;&#xA;     # Determine the resolutions to transcode based on the provided or default resolution&#xA;     resolutions_to_transcode = [res for res in [240, 360, 480, 720] if resolutions is None or res in resolutions]&#xA;&#xA;     # If resolutions is not exactly 360, 480, 720, or 1080, transcode to the nearest lower resolution&#xA;     if resolutions is not None:&#xA;         resolutions_to_transcode = [get_closest_lower_resolution(res) for res in resolutions]&#xA;&#xA;     # Transcode the video into the specified resolutions&#xA;     for res in resolutions_to_transcode:&#xA;         output_folder = os.path.join(unique_id_folder, f"{res}p")&#xA;         Path(output_folder).mkdir(parents=True, exist_ok=True)&#xA;&#xA;         # Call the transcode_video function with tqdm progress bar&#xA;         with tqdm(total=100, desc=f"Transcoding {res}p", position=0, leave=True) as pbar:&#xA;             await transcode_video(input_path, output_folder, res, unique_id, total_files, pbar)&#xA;&#xA;     # Create index.m3u8 file after transcoding all resolutions&#xA;     create_index_m3u8(unique_id, resolutions_to_transcode)&#xA;&#xA; return JSONResponse(content={"message": f"{total_files[0]} videos transcoded."})&#xA;

    &#xA;

    If I provide one resolution it works fine. But if I provide a list of resolutions for all the uploaded videos I am getting error 422.

    &#xA;

    &#xA;Code    Details&#xA;422 &#xA;Error: Unprocessable Entity&#xA;&#xA;Response body&#xA;Download&#xA;{&#xA;  "detail": [&#xA;    {&#xA;      "loc": [&#xA;        "body",&#xA;        "resolutions",&#xA;        0&#xA;      ],&#xA;      "msg": "value is not a valid integer",&#xA;      "type": "type_error.integer"&#xA;    }&#xA;  ]&#xA;}&#xA;

    &#xA;

    I used python 3.8.18. Can you help me please ? I tried with list, object but always getting the error.

    &#xA;