
Recherche avancée
Médias (10)
-
Demon Seed
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Demon seed (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
The four of us are dying (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Corona radiata (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Lights in the sky (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Head down (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
Autres articles (36)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...)
Sur d’autres sites (8368)
-
Getting Error while trying to download youtube video by using python
23 octobre 2024, par Aditya KumarCode


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.




-
'Source code does not match byte code' Android Studio
26 août 2020, par ConnoeI'm developing an Android video editing app using FFmpeg libraries in Android Studio version 4.01. When I try to debug, the debugger steps into the decompiler and flashes, 'Source code does not match byte code' across multiple steps through the decompiled code. The debugger also seems to be jumping around the decompiled code semi-randomly, for example : here, where logSlowDispatch is false but the debugger steps into the contents of the if statement anyway without checking and flashes 'Source code does not match byte code'. I've looked at alot of posts about this problem and have tried many of the suggested solutions from invalidate cache/restart to a fresh install of Android Studio to no avail. I've read that redundant or outdated gradle dependencies might have something to do with this, but removing some of these dependencies hasn't helped :


apply plugin: 'com.android.application'

android {
 compileSdkVersion 29
 defaultConfig {
 applicationId "com.example.capstoneapplication"
 minSdkVersion 21
 targetSdkVersion 29
 versionCode 1
 versionName "1.0"
 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
 ndkVersion "21.3.6528147"
 }
 buildTypes {
 release {
 minifyEnabled false
 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
 }
 }
}

dependencies {
 implementation fileTree(dir: 'libs', include: ['*.jar'])

 implementation 'com.android.support.constraint:constraint-layout:2.0.0'

 testImplementation 'junit:junit:4.12'
 androidTestImplementation 'com.android.support.test:runner:1.0.2'
 androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

 implementation 'com.writingminds:FFmpegAndroid:0.3.2'

 implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'

 implementation 'com.intuit.sdp:sdp-android:1.0.6'
}



My code seems to be running properly and executing the ffmpeg command on the desired video between these jumps to the decompiler, but the video does not save. Here is a snippet from the java class that might be causing this :


@Override
 public boolean onOptionsItemSelected(MenuItem menuItem){
 if(menuItem.getItemId()==R.id.trim){
 final AlertDialog.Builder alertDialog = new AlertDialog.Builder(com.example.capstoneapplication.VideoTrimmer.this);

 LinearLayout linLay = new LinearLayout(com.example.capstoneapplication.VideoTrimmer.this);
 linLay.setOrientation(LinearLayout.VERTICAL);
 LinearLayout.LayoutParams layPar = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
 layPar.setMargins(50, 0, 50, 100 );
 final EditText input = new EditText(com.example.capstoneapplication.VideoTrimmer.this);
 input.setLayoutParams(layPar);
 input.setGravity(Gravity.TOP|Gravity.START);
 input.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
 linLay.addView(input,layPar);

 alertDialog.setMessage("Enter Video Name");
 alertDialog.setTitle("Change Video Name");
 alertDialog.setView(linLay);
 alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
 @Override
 public void onClick(DialogInterface dialog, int which) {
 dialog.dismiss();
 }
 });
 alertDialog.setPositiveButton("Submit", new DialogInterface.OnClickListener() {
 @Override
 public void onClick(DialogInterface dialog, int which) {
 fileName = input.getText().toString();

 try {
 snipVideo(videoDurBar.getAbsoluteMinValue().intValue(), videoDurBar.getSelectedMaxValue().intValue(), fileName);
 } catch ( FFmpegNotSupportedException e) {
 e.printStackTrace();
 }


 }
 });
 alertDialog.show();
 }
 return super.onOptionsItemSelected(menuItem);
 }

 private void snipVideo( int min, int max, String fileName) throws FFmpegNotSupportedException {

 File destFolder = new File("storage/emulated/0" + "/EditingApeSnippedVideos");
 if(!destFolder.exists()){
 destFolder.mkdir();
 }
 String fileExtension = ".mp4";
 destination = new File(destFolder, fileName + fileExtension);
 inputVideoPath = getPathFromUri(getApplicationContext(),uri);


 command = new String[]{"-ss", "" + min/1000 , "-y", "-i", inputVideoPath, "-t", ""+ (max-min)/1000 ,"-vcodec", "mpeg4", "-b:v","2097152","-b:a", "48000", "-ac","2","-ar","22050", destination.getAbsolutePath()};

 //testing command
 //command = new String []{"-y", "-i", inputVideoPath, "-ss", "00:00:02" , "-to", "00:00:03", "-c", "copy", destination.getAbsolutePath()};
 final FFmpeg ff = FFmpeg.getInstance(this);
 ff.loadBinary(new FFmpegLoadBinaryResponseHandler() {

 @Override
 public void onStart() {

 Log.i("VideoTrimmer","onStart");
 }

 @Override
 public void onFinish() {
 Log.i("VideoTrimmer","onFinish");
 }

 @Override
 public void onFailure() {
 Log.i("VideoTrimmer","onFailure");
 }

 @Override
 public void onSuccess() {
 Log.i("VideoTrimmer","Success");
 try {
 ff.execute(command, new ExecuteBinaryResponseHandler());
 } catch (FFmpegCommandAlreadyRunningException e) {
 Log.i("VideoTrimmer","FFmpegAlreadyRunning Exception");

 }
 }
 });
 }



Has anyone found a solution to this debugger issue ?


-
Use https for the demos.
14 septembre 2014, par blueimpUse https for the demos.