Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (78)

  • D’autres logiciels intéressants

    12 avril 2011, par

    On ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
    La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
    On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
    Videopress
    Site Internet : (...)

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

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

Sur d’autres sites (10423)

  • Trouble downloading a youtube playlist and converting to mp4 with audio/video

    15 mars 2024, par Patrick Coogan

    I am having difficulty with a side project I am working on. The goal of the program is to be able to do a few functions with a youtube video or playlist link.

    


      

    1. download a youtube video and audio and merge them.
    2. 


    3. download a youtube playlist's video and audio and merge them.
    4. 


    5. download a youtube video's audio only.
    6. 


    7. download a youtube playlist's audio only.
    8. 


    


    My main issues arise with the 2. function, downloading a playlist with video and audio and merging them. The program is able to complete function 1 successfully (download a video and audio and merge to one file), and function 3 successfully (download video and output just audio file) Function 4 hasn't been implemented at all yet.

    


    The program is broken into 2 main files : youtube_downloader.py and main.py
The errors I receive from output of running function 2 are listed after the code below

    


    I am hoping for some clarification on what the errors are describing any advice on implementing the second function outlined in comments below.

    


    main.py

    


    from youtube_downloader import download_playlist,input_links,download_video,convert_to_mp3,convert_to_mp4
from moviepy.editor import VideoFileClip, AudioFileClip, concatenate_videoclips
import os


print("Load Complete\n")

print('''
What would you like to do?
(1) Download a YouTube video and audio
(2) Download a YouTube Playlist (video and audio)
(3) Download a YouTube Video's audio only
(4) Download a Youtube Playlist's audio only
(q) Quit
''')

done = False

while done == False:
    #ask user for choice
    choice = input("Choice: ")
    if choice == "1" or choice == "2":
        # Sets Quality Option of video(s)
        quality = input("Please choose a quality (low or 0, medium or 1, high or 2, very high or 3):")
        #download videos manually
        if choice == "1":
            links = input_links()
            print('Download has been started')
            for link in links: 
                filename = download_video(link, quality)
                convert_to_mp4(filename)
                print("Download finished!")
        #download a playlist
        if choice == "2":
            link = input("Enter the link to the playlist: ")
            print("Downloading playlist...")
            filenames = download_playlist(link, quality)
            print("Download finished! Beginning conversion...")
            **#################################################################
            for file in os.listdir('./Downloaded/'):
                convert_to_mp4(filenames)
            #################################################################**
            print("Conversion finished!")
    elif choice == "3":
        links = input_links()
        for link in links:
            print("Downloading...")
            filename = download_video(link, 'low')
            print("Converting...")
            convert_to_mp3(filename)
            os.remove(filename)
    elif choice == "4":
        pass
        #TODO: add option 4 code
    elif choice == "q" or choice == "Q":
        done = True
        print("Goodbye")
    else:
        print("Invalid input!")


    


    youtube_downloader.py

    


    import pytube
from pytube import YouTube, Playlist
from pytube.cli import on_progress
from moviepy.editor import VideoFileClip, AudioFileClip
import os

"""
Downloads video to a 'Downloaded' folder in the same dir as the program.

"""

def download_video(url, resolution):
    itag = choose_resolution(resolution)
    video = YouTube(url,on_progress_callback=on_progress)
    stream = video.streams.get_by_itag(itag)
    try:
        os.mkdir('./Downloaded/')
    except:
        pass
    stream.download(output_path='./Downloaded/')
    return f'./Downloaded/{stream.default_filename}'

def download_videos(urls, resolution):
    for url in urls:
        download_video(url, resolution)

def download_playlist(url, resolution):
    playlist = Playlist(url)
    download_videos(playlist.video_urls, resolution)

def choose_resolution(resolution):
    if resolution in ["low", "360", "360p","0"]:
        itag = 18
    elif resolution in ["medium", "720", "720p", "hd","1"]:
        itag = 22
    elif resolution in ["high", "1080", "1080p", "fullhd", "full_hd", "full hd","2"]:
        itag = 137
    elif resolution in ["very high", "2160", "2160p", "4K", "4k","3"]:
        itag = 313
    else:
        itag = 18
    return itag


def input_links():
    print("Enter the links of the videos (end by entering 'stop' or 0):")

    links = []
    link = ""

    while link != "0" and link.lower() != "stop":
        link = input("video_url or \"stop\": ")
        links.append(link)
    
    if len(links)==1:
        print("No links were inputed")
        exit()

    links.pop()

    return links

def convert_to_mp3(filename):
    clip = VideoFileClip(filename)
    clip.audio.write_audiofile(filename[:-3] + "mp3")
    clip.close()

def convert_to_mp4(filename):
    video_clip = VideoFileClip(filename)
    audio_clip = AudioFileClip(filename)
    final_clip = video_clip.set_audio(audio_clip)
    final_clip.write_videofile(filename[:-3] + "mp4")
    final_clip.close()


    


    Error output

    


    Traceback (most recent call last):&#xA;  File "C:\Users\ptcoo\Documents\youtube-downloader-converter\main.py", line 44, in <module>&#xA;    convert_to_mp4(filenames)&#xA;  File "C:\Users\ptcoo\Documents\youtube-downloader-converter\youtube_downloader.py", line 69, in convert_to_mp4&#xA;    video_clip = VideoFileClip(filename)&#xA;                 ^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "C:\Users\ptcoo\AppData\Roaming\Python\Python312\site-packages\moviepy\video\io\VideoFileClip.py", line 88, in __init__&#xA;    self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,&#xA;                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "C:\Users\ptcoo\AppData\Roaming\Python\Python312\site-packages\moviepy\video\io\ffmpeg_reader.py", line 35, in __init__&#xA;    infos = ffmpeg_parse_infos(filename, print_infos, check_duration,&#xA;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "C:\Users\ptcoo\AppData\Roaming\Python\Python312\site-packages\moviepy\video\io\ffmpeg_reader.py", line 244, in ffmpeg_parse_infos&#xA;    is_GIF = filename.endswith(&#x27;.gif&#x27;)&#xA;             ^^^^^^^^^^^^^^^^^&#xA;AttributeError: &#x27;NoneType&#x27; object has no attribute &#x27;endswith&#x27;&#xA;</module>

    &#xA;

  • Downloading video & audio segment simultaneously with youtube-dl and ffmpeg

    7 décembre 2020, par Mtaly

    For an online streaming video that I would like to download I have two m3u8 files.

    &#xA;

    One for the video itself with segment-0.ts to segment-250.ts :

    &#xA;

    #EXTINF:6.000000,&#xA;segment-0.ts&#xA;#EXTINF:6.000000,&#xA;segment-1.ts&#xA;#EXTINF:6.000000,&#xA;segment-2.ts&#xA;#EXTINF:6.000000,&#xA;segment-3.ts&#xA;#EXTINF:6.000000,&#xA;segment-4.ts&#xA;

    &#xA;

    and another m3u8 for the audio segments :

    &#xA;

    #EXTINF:6.016000,&#xA;segment-0.aac&#xA;#EXTINF:6.016000,&#xA;segment-1.aac&#xA;#EXTINF:6.016000,&#xA;segment-2.aac&#xA;#EXTINF:6.016000,&#xA;segment-3.aac&#xA;#EXTINF:6.016000,&#xA;

    &#xA;

    So, I use youtube-dl and ffmpeg to download the both m3u8 separately then merge them to get the final mp4 (audio+video).

    &#xA;

    Is there a way to merge the files or use a combined command in the Terminal to automatically download both and merge them ?

    &#xA;

  • ffmpeg live stream to Youtube command line

    30 juin 2020, par brainoverflowse

    Would anyone assist myself with creating the correct ffmpeg command line for an audio and video rtsp camera feed that is 1440 and scale it to 1080 with a max bitrate of 10000 ?

    &#xA;