Recherche avancée

Médias (91)

Autres articles (95)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (12153)

  • ffmpeg compression commands to make diffrent video formats like youtube ?

    9 juillet 2022, par Sahll saharn

    I am trying to make a video streaming clone. suppose i got the raw video and wanted to compress in diff formats and store it into database so what command should i use to convert same video to multiple quality formats like in other streaming platforms 720p , 480p , 360p
suppose our raw file is input.mp4

    


  • Python PyQt5 and youtube-dl GUI console popping when converting to mp3 with ffmpeg [on hold]

    29 juin 2018, par Giblin

    I will be jumping right to the issue I am having for a while.
    I have built a GUI software with Python 3.6 with PyQt5 and the youtube-dl package for downloading audios.
    The software downloads files in mp4, 3gp, m4a and webm extensions with no problems at all and then, here comes the mp3 to change the balance for ever !
    So what it basically does, is that while it downloads it as mp3, by the time it converts it with ffmpeg (same issue with ffprobe), a console window pops right out of the GUI and does its magic.
    I have made all the necessary customizations in the code, such as to run the ffmpeg with verbose etc but it won’t go away.
    Changing the file extension from .py to .pyw doesn’t help either.
    I think it is more of a windows problem and not really a programming issue, so I thought maybe a bat script could always run it silent in the background when it pops ? And if so, I would appreciate a heads-up because I have no experience in bat scripting.
    Thanks in advance and sorry if I went on for too long.

    EDIT :

    Here’s the console I get during the convert when I download a URL as mp3 (this pops like that until it finishes the conversion to mp3 and then disappears) :

    FFMPEG Console

    And here’s the function with the options responsible for that (for other extensions, the code is similar with just few name changes but ffmpeg isn’t necessary for them in order to convert) :

    def youtubeMP3(self):
       options = {
           'format': 'bestaudio/best',
           'extractaudio': True,
           'audioformat': 'mp3',
           'outtmpl': self.location + '/%(title)s-%(id)s.%(ext)s',
           'quiet': True,
           'no_warnings': True,
           'nocheckcertificate': True,
           'progress_hooks': [self.hookMP3],
           'postprocessors': [{
               'key': 'FFmpegExtractAudio',
               'preferredcodec': 'mp3',
               'preferredquality': '192'
           }]
       }
       value = self.urlText.text()
       if value != "" and validators.url(value):
           with youtube_dl.YoutubeDL(options) as ydl:
               try:
                   ydl.download([value])
                   self.progressLabel.setText("The download was successful.")
                   self.urlText.clear()
                   time.sleep(5)
                   self.progressLabel.setText("")
               except:
                   self.progressLabel.setText("This video URL does not exist.")
                   self.urlText.clear()
                   time.sleep(5)
                   self.progressLabel.setText("")
  • Getting Error while trying to download youtube video by using python

    23 octobre 2024, par Aditya Kumar

    Code

    


    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.

    


    Here’s the complete code :

    


    import yt_dlp
import os
import subprocess

# Function to list and allow manual selection of video and audio formats
def download_and_merge_video_audio_with_selection(url, download_path):
    try:
        # Ensure the download path exists
        if not os.path.exists(download_path):
            os.makedirs(download_path)

        # Get available formats from yt-dlp
        ydl_opts = {'listformats': True}

        with yt_dlp.YoutubeDL(ydl_opts) as ydl:
            info_dict = ydl.extract_info(url, download=False)
            formats = info_dict.get('formats', [])

        # List available video formats (video only)
        print("\nAvailable video formats:")
        video_formats = [f for f in formats if f.get('vcodec') != 'none' and f.get('acodec') == 'none']
        for idx, f in enumerate(video_formats):
            resolution = f.get('height', 'unknown')
            filesize = f.get('filesize', 'unknown')
            print(f"{idx}: Format code: {f['format_id']}, Resolution: {resolution}p, Size: {filesize} bytes")

        # Let user select the desired video format
        video_idx = int(input("\nEnter the number corresponding to the video format you want to download: "))
        video_format_code = video_formats[video_idx]['format_id']

        # List available audio formats (audio only)
        print("\nAvailable audio formats:")
        audio_formats = [f for f in formats if f.get('acodec') != 'none' and f.get('vcodec') == 'none']
        for idx, f in enumerate(audio_formats):
            abr = f.get('abr', 'unknown')  # Audio bitrate
            filesize = f.get('filesize', 'unknown')
            print(f"{idx}: Format code: {f['format_id']}, Audio Bitrate: {abr} kbps, Size: {filesize} bytes")

        # Let user select the desired audio format
        audio_idx = int(input("\nEnter the number corresponding to the audio format you want to download: "))
        audio_format_code = audio_formats[audio_idx]['format_id']

        # Video download options (based on user choice)
        video_opts = {
            'format': video_format_code,  # Download user-selected video format
            'outtmpl': os.path.join(download_path, 'video.%(ext)s'),  # Save video as video.mp4
        }

        # Audio download options (based on user choice)
        audio_opts = {
            'format': audio_format_code,  # Download user-selected audio format
            'outtmpl': os.path.join(download_path, 'audio.%(ext)s'),  # Save audio as audio.m4a
        }

        # Download the selected video format
        print("\nDownloading selected video format...")
        with yt_dlp.YoutubeDL(video_opts) as ydl_video:
            ydl_video.download([url])

        # Download the selected audio format
        print("\nDownloading selected audio format...")
        with yt_dlp.YoutubeDL(audio_opts) as ydl_audio:
            ydl_audio.download([url])

        # Paths to the downloaded video and audio files
        video_file = os.path.join(download_path, 'video.webm')  # Assuming best video will be .mp4
        audio_file = os.path.join(download_path, 'audio.m4a')  # Assuming best audio will be .m4a
        output_file = os.path.join(download_path, 'final_output.mp4')  # Final merged file

        # FFmpeg command to merge audio and video
        ffmpeg_cmd = [
            'ffmpeg', '-i', video_file, '-i', audio_file, '-c', 'copy', output_file
        ]

        # Run FFmpeg to merge audio and video
        print("\nMerging video and audio...")
        subprocess.run(ffmpeg_cmd, check=True)

        print(f"\nDownload and merging complete! Output file: {output_file}")

    except Exception as e:
        print(f"An error occurred: {e}")

# Example usage
video_url = "https://www.youtube.com/watch?v=SOwk8FhfEZY"  # Replace with your desired video URL
download_path = 'C:/Users/vinod/Downloads/VideoDownload'  # Replace with your desired download path
download_and_merge_video_audio_with_selection(video_url, download_path)



    


    Explanation :

    


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

    


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

    


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

    


    Error

    


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

    


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


    


    Requirements :

    


    


    yt-dlp : pip install yt-dlp

    


    


    


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