
Recherche avancée
Médias (91)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
-
avec chosen
13 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
sans chosen
13 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
config chosen
13 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
SPIP - plugins - embed code - Exemple
2 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
Autres articles (85)
-
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 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 (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.
Sur d’autres sites (11906)
-
ffmpeg live stream to Youtube command line
30 juin 2020, par brainoverflowseWould 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 ?


-
Downloading video & audio segment simultaneously with youtube-dl and ffmpeg
7 décembre 2020, par MtalyFor an online streaming video that I would like to download I have two m3u8 files.


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


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



and another m3u8 for the audio segments :


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



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


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


-
Trouble downloading a youtube playlist and converting to mp4 with audio/video
15 mars 2024, par Patrick CooganI 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.


- 

- download a youtube video and audio and merge them.
- download a youtube playlist's video and audio and merge them.
- download a youtube video's audio only.
- download a youtube playlist's audio only.










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