Recherche avancée

Médias (1)

Mot : - Tags -/illustrator

Autres articles (31)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

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

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (6721)

  • lavf : restore old behavior for custom AVIOContex with an AVFMT_NOFILE format.

    24 juin 2011, par Anton Khirnov

    lavf : restore old behavior for custom AVIOContex with an AVFMT_NOFILE format.

  • avformat/dashenc : allow setting custom movflags using format_options

    20 novembre 2019, par James Almer
    avformat/dashenc : allow setting custom movflags using format_options
    

    Signed-off-by : James Almer <jamrial@gmail.com>

    • [DH] libavformat/dashenc.c
  • Getting Error while trying to download youtube video by using python

    23 octobre 2024, par Aditya Kumar

    Code

    &#xA;

    I'm working on a script that allows users to manually select and download separate video and audio streams from YouTube using yt-dlp. The script lists the available video and audio formats, lets the user choose their desired formats, and then merges them using FFmpeg.

    &#xA;

    Here’s the complete code :

    &#xA;

    import yt_dlp&#xA;import os&#xA;import subprocess&#xA;&#xA;# Function to list and allow manual selection of video and audio formats&#xA;def download_and_merge_video_audio_with_selection(url, download_path):&#xA;    try:&#xA;        # Ensure the download path exists&#xA;        if not os.path.exists(download_path):&#xA;            os.makedirs(download_path)&#xA;&#xA;        # Get available formats from yt-dlp&#xA;        ydl_opts = {&#x27;listformats&#x27;: True}&#xA;&#xA;        with yt_dlp.YoutubeDL(ydl_opts) as ydl:&#xA;            info_dict = ydl.extract_info(url, download=False)&#xA;            formats = info_dict.get(&#x27;formats&#x27;, [])&#xA;&#xA;        # List available video formats (video only)&#xA;        print("\nAvailable video formats:")&#xA;        video_formats = [f for f in formats if f.get(&#x27;vcodec&#x27;) != &#x27;none&#x27; and f.get(&#x27;acodec&#x27;) == &#x27;none&#x27;]&#xA;        for idx, f in enumerate(video_formats):&#xA;            resolution = f.get(&#x27;height&#x27;, &#x27;unknown&#x27;)&#xA;            filesize = f.get(&#x27;filesize&#x27;, &#x27;unknown&#x27;)&#xA;            print(f"{idx}: Format code: {f[&#x27;format_id&#x27;]}, Resolution: {resolution}p, Size: {filesize} bytes")&#xA;&#xA;        # Let user select the desired video format&#xA;        video_idx = int(input("\nEnter the number corresponding to the video format you want to download: "))&#xA;        video_format_code = video_formats[video_idx][&#x27;format_id&#x27;]&#xA;&#xA;        # List available audio formats (audio only)&#xA;        print("\nAvailable audio formats:")&#xA;        audio_formats = [f for f in formats if f.get(&#x27;acodec&#x27;) != &#x27;none&#x27; and f.get(&#x27;vcodec&#x27;) == &#x27;none&#x27;]&#xA;        for idx, f in enumerate(audio_formats):&#xA;            abr = f.get(&#x27;abr&#x27;, &#x27;unknown&#x27;)  # Audio bitrate&#xA;            filesize = f.get(&#x27;filesize&#x27;, &#x27;unknown&#x27;)&#xA;            print(f"{idx}: Format code: {f[&#x27;format_id&#x27;]}, Audio Bitrate: {abr} kbps, Size: {filesize} bytes")&#xA;&#xA;        # Let user select the desired audio format&#xA;        audio_idx = int(input("\nEnter the number corresponding to the audio format you want to download: "))&#xA;        audio_format_code = audio_formats[audio_idx][&#x27;format_id&#x27;]&#xA;&#xA;        # Video download options (based on user choice)&#xA;        video_opts = {&#xA;            &#x27;format&#x27;: video_format_code,  # Download user-selected video format&#xA;            &#x27;outtmpl&#x27;: os.path.join(download_path, &#x27;video.%(ext)s&#x27;),  # Save video as video.mp4&#xA;        }&#xA;&#xA;        # Audio download options (based on user choice)&#xA;        audio_opts = {&#xA;            &#x27;format&#x27;: audio_format_code,  # Download user-selected audio format&#xA;            &#x27;outtmpl&#x27;: os.path.join(download_path, &#x27;audio.%(ext)s&#x27;),  # Save audio as audio.m4a&#xA;        }&#xA;&#xA;        # Download the selected video format&#xA;        print("\nDownloading selected video format...")&#xA;        with yt_dlp.YoutubeDL(video_opts) as ydl_video:&#xA;            ydl_video.download([url])&#xA;&#xA;        # Download the selected audio format&#xA;        print("\nDownloading selected audio format...")&#xA;        with yt_dlp.YoutubeDL(audio_opts) as ydl_audio:&#xA;            ydl_audio.download([url])&#xA;&#xA;        # Paths to the downloaded video and audio files&#xA;        video_file = os.path.join(download_path, &#x27;video.webm&#x27;)  # Assuming best video will be .mp4&#xA;        audio_file = os.path.join(download_path, &#x27;audio.m4a&#x27;)  # Assuming best audio will be .m4a&#xA;        output_file = os.path.join(download_path, &#x27;final_output.mp4&#x27;)  # Final merged file&#xA;&#xA;        # FFmpeg command to merge audio and video&#xA;        ffmpeg_cmd = [&#xA;            &#x27;ffmpeg&#x27;, &#x27;-i&#x27;, video_file, &#x27;-i&#x27;, audio_file, &#x27;-c&#x27;, &#x27;copy&#x27;, output_file&#xA;        ]&#xA;&#xA;        # Run FFmpeg to merge audio and video&#xA;        print("\nMerging video and audio...")&#xA;        subprocess.run(ffmpeg_cmd, check=True)&#xA;&#xA;        print(f"\nDownload and merging complete! Output file: {output_file}")&#xA;&#xA;    except Exception as e:&#xA;        print(f"An error occurred: {e}")&#xA;&#xA;# Example usage&#xA;video_url = "https://www.youtube.com/watch?v=SOwk8FhfEZY"  # Replace with your desired video URL&#xA;download_path = &#x27;C:/Users/vinod/Downloads/VideoDownload&#x27;  # Replace with your desired download path&#xA;download_and_merge_video_audio_with_selection(video_url, download_path)&#xA;&#xA;

    &#xA;

    Explanation :

    &#xA;

    The script first lists all available video formats (video-only) and audio formats (audio-only) from a given YouTube URL.

    &#xA;

    It allows the user to manually select their preferred video and audio formats.

    &#xA;

    After downloading the selected formats, it merges the video and audio streams into a single file using FFmpeg.

    &#xA;

    Error

    &#xA;

    while trying to run above mentioned code , I am getting this error :

    &#xA;

    Merging video and audio...&#xA;An error occurred: [WinError 2] The system cannot find the file specified&#xA;

    &#xA;

    Requirements :

    &#xA;

    &#xA;

    yt-dlp : pip install yt-dlp

    &#xA;

    &#xA;

    &#xA;

    FFmpeg : Make sure you have FFmpeg installed and added to your system's PATH.

    &#xA;

    &#xA;