Recherche avancée

Médias (91)

Autres articles (97)

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

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

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (10192)

  • python [WinError 2] the System Cannot Find the File Specified

    15 août 2024, par user26831166

    Code cant create a certain file
The thing is code isn't mine a took it from a friend and my friend get it from another person
and this 2 person can run code without any problem
but i have.

    


    import os
import random
import shutil
import subprocess

# Путь к папке с видео
video_folder = r'D:\bots\ttvidads\VID\Videorez'

# Путь к папке для сохранения результатов
output_folder = r'D:\bots\ttvidads\VID\ZAGOTOVKI\Videopod1'

# Очищаем содержимое конечной папки перед сохранением
for file in os.listdir(output_folder):
    file_path = os.path.join(output_folder, file)
    try:
        if os.path.isfile(file_path):
            os.unlink(file_path)
    except Exception as e:
        print(f"Failed to delete {file_path}. Reason: {e}")

# Получаем список видеофайлов
video_files = [os.path.join(video_folder, file) for file in os.listdir(video_folder) if file.endswith(('.mp4', '.avi'))]

# Выбираем случайное видео
random_video = random.choice(video_files)

# Получаем длительность видео в секундах
video_duration_command = f'ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "{random_video}"'
video_duration_process = subprocess.Popen(video_duration_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
video_duration_output, _ = video_duration_process.communicate()
video_duration = float(video_duration_output)

# Выбираем случайное начальное время для вырезания
random_start = random.randrange(0, int(video_duration) - 19, 8)

# Получаем ширину и высоту исходного видео
video_info_command = f'ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "{random_video}"'
video_info_process = subprocess.Popen(video_info_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
video_info_output, _ = video_info_process.communicate()
video_width, video_height = map(int, video_info_output.strip().split(b'x'))

# Вычисляем новые координаты x1 и x2 для обрезки
max_x1 = video_width - int(video_height * 9 / 16)
random_x1 = random.randint(0, max_x1)
random_x2 = random_x1 + int(video_height * 9 / 16)

# Формируем команду для FFmpeg для выборки случайного отрезка видео с соотношением 9:16
ffmpeg_command = f'ffmpeg -hwaccel cuda -ss {random_start} -i "{random_video}" -t 19 -vf "crop={random_x2-random_x1}:{video_height}:{random_x1}:0" -c:v h264_nvenc -preset default -an -c:a aac -b:a 128k "{output_folder}\\temp.mp4"'

# Выполняем команду с помощью subprocess
subprocess.run(ffmpeg_command, shell=True)

# Изменяем яркость, контрастность и размываем видео
brightness_factor = random.uniform(-0.18, -0.12)  # Случайный коэффициент яркости
contrast_factor = random.uniform(0.95, 1.05)  # Случайный коэффициент контрастности
blur_factor = random.uniform(4, 5)  # Случайный коэффициент размытия

# Формируем команду для FFmpeg для изменения яркости, контрастности и размытия видео
ffmpeg_modify_command = f'ffmpeg -hwaccel cuda -i "{output_folder}\\temp.mp4" -vf "eq=brightness={brightness_factor}:contrast={contrast_factor},boxblur={blur_factor}:{blur_factor}" -c:v h264_nvenc -preset default -an -c:a aac -b:a 128k "{output_folder}\\temp_modify.mp4"'

# Выполняем команду с помощью subprocess
subprocess.run(ffmpeg_modify_command, shell=True)

# Растягиваем видео до нужного разрешения (1080x1920)
ffmpeg_stretch_command = f'ffmpeg -hwaccel cuda -i "{output_folder}\\temp_modify.mp4" -vf "scale=1080:1920" -c:v h264_nvenc -preset default -an -c:a aac -b:a 128k -r 30 "{output_folder}\\final_output.mp4"'

# Выполняем команду с помощью subprocess
subprocess.run(ffmpeg_stretch_command, shell=True)

# Удаляем временные файлы
os.remove(os.path.join(output_folder, 'temp.mp4'))
os.remove(os.path.join(output_folder, 'temp_modify.mp4'))

print("Видеофайл успешно обработан и сохранен.")


    


    Error i got after run the code

    


    = RESTART: D:\Bots\2vidpod.py&#xA;Traceback (most recent call last):&#xA;  File "D:\Bots\2vidpod.py", line 71, in <module>&#xA;    os.remove(os.path.join(output_folder, &#x27;temp.mp4&#x27;))&#xA;FileNotFoundError: [WinError 2] Не удается найти указанный файл: &#x27;D:\\bots\\ttvidads\\VID\\ZAGOTOVKI\\Videopod1\\temp.mp4&#x27;&#xA;</module>

    &#xA;

    so things i checked is&#xA;path is right&#xA;programs is installed FFMPEG and PYTHON all additional libraries downloaded&#xA;i pretty sure error caused by regular path and i wanna know if absolute path can do the thing

    &#xA;

  • 2023-04-18 18:25:05 INFO discord.player ffmpeg process ##### successfully terminated with return code of 0

    19 avril 2023, par I_am_thing

    I am making a discord music bot with discord.py and ctx, it uses Spotify

    &#xA;

    I am using FFmpeg for my music feature. This is my !play code

    &#xA;

    client_id = &#x27;&#x27;&#xA;client_secret = &#x27;&#x27;&#xA;client_credentials_manager = SpotifyClientCredentials(client_id=client_id, client_secret=client_secret)&#xA;sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)&#xA;&#xA;bot.volume = 0.5 # initial volume of the bot (can be changed)&#xA;&#xA;@bot.command()&#xA;async def play(ctx, *, track_query):&#xA;    # check if the query is a valid Spotify link&#xA;    if &#x27;open.spotify.com/track/&#x27; in track_query:&#xA;        track_id = track_query.split(&#x27;/&#x27;)[-1] # extract the track ID from the link&#xA;    else:&#xA;        # search for tracks with the given name&#xA;        track_results = sp.search(q=track_query, type=&#x27;track&#x27;, limit=1)&#xA;        if len(track_results[&#x27;tracks&#x27;][&#x27;items&#x27;]) == 0:&#xA;            await ctx.send(f&#x27;Sorry, I could not find any track with the name "{track_query}".&#x27;)&#xA;            return&#xA;        track_id = track_results[&#x27;tracks&#x27;][&#x27;items&#x27;][0][&#x27;id&#x27;] # get the track ID for the first search result&#xA;    track_info = sp.track(track_id) # get the track information for the given ID&#xA;    track_name = track_info[&#x27;name&#x27;]&#xA;    track_artist = track_info[&#x27;artists&#x27;][0][&#x27;name&#x27;]&#xA;    track_duration = time.strftime(&#x27;%M:%S&#x27;, time.gmtime(track_info[&#x27;duration_ms&#x27;]//1000))&#xA;    track_preview_url = track_info[&#x27;preview_url&#x27;] # get the preview URL for the track&#xA;    if track_preview_url is None:&#xA;        await ctx.send(f&#x27;Sorry, the track "{track_name}" by {track_artist} cannot be played.&#x27;)&#xA;        return&#xA;    voice_channel = ctx.author.voice.channel&#xA;    if voice_channel is None:&#xA;        await ctx.send(&#x27;Please join a voice channel first.&#x27;)&#xA;        return&#xA;    voice_client = await voice_channel.connect()&#xA;    audio_source = discord.FFmpegPCMAudio(track_preview_url, options="-b:a 128k -bufsize 512k")&#xA;    voice_client.play(audio_source, after=lambda e: print(&#x27;Player error: %s&#x27; % e) if e else None)&#xA;    voice_client.source = discord.PCMVolumeTransformer(voice_client.source)&#xA;    voice_client.source.volume = bot.volume&#xA;&#xA;    # format the embed message&#xA;    embed = discord.Embed(title=track_name, description=track_artist, color=0xff8c00)&#xA;    embed.add_field(name=&#x27;Duration&#x27;, value=track_duration, inline=True)&#xA;    embed.set_thumbnail(url=track_info[&#x27;album&#x27;][&#x27;images&#x27;][0][&#x27;url&#x27;])&#xA;    embed.set_footer(text=&#x27;This music is from https://www.spotify.com/&#x27;)&#xA;    await ctx.send(embed=embed)&#xA;&#xA;    while voice_client.is_playing():&#xA;        await asyncio.sleep(1)&#xA;    await voice_client.disconnect()&#xA;

    &#xA;

    I joined the unofficial ffmpeg discord server no one could find a fix I searched for ages and I couldn't fix it

    &#xA;

  • Android Recorded Video Compression

    28 juillet 2014, par Nick Babenko

    This is a fairly long-winded issue and I’ve tried a couple of methods to fix it.

    The ultimate problem is the user records a video and the video is to be uploaded via a REST API. The original solution was to use the camera app and pass the user though via an Intent. This method requires very little configuration for video optimisation - using the MediaStore.EXTRA_VIDEO_QUALITY and value of 0 gives MMS optimisation, which makes the videos pretty much unusable and I was hoping for something a little more around 480p.

    So I started to create a custom video recorder using the MediaRecorder class. I managed to get this to work fine on a Nexus 4. I have 2 other test devices, a ZTE Blade and an Acer Iconica tab and it didn’t work with either of these devices.
    The ZTE Blade complained about an incorrect video size but the video size I was using was given by Camera.Parameters.getSupportedVideoSizes.
    The Acer Iconica tab didn’t have any valid CamcorderProfile’s. Calling CamcorderProfile.hasProfile on all of the available CamcorderProfile constants returned false. So if I was unsuccessful at loading a CamcorderProfile I attempted to configure MediaRecorder manually based on a device profile I found. This worked to an extent, but when I pressed record, I was presented with a black screen.

    The second solution was to use the existing camera intent solution, but then compress the video using FFMPEG. My experience of using the Android NDK is nil, so it was a bit of a challenge. I managed to compile a library which interfaces natively with FFMEG - this one specifically (https://github.com/Batterii/android-ffmpeg-x264). The Videokit class initialises, but when it comes to calling run with the following arguments :

    videoKit.run(new String[] {"ffmpeg", "-i", file.getAbsolutePath(), "-vf",
                           "scale=-1:480", "-vcodec", "mp3g4", "-qscale", "3",
                           outputFile.getAbsolutePath()});

    The app suddenly stops with no exception and almost nothing in the logs except that the activity suddenly stopped.

    The ultimate question I’ve been getting to is wether anyone has any solution to compress a video recorded on an Android device. If anyone can add to any of the issues I mentioned which hopefully will fix the issue, but I can’t quite get working then I will appreciate that even more.

    Thanks for reading and any help anyone has is incredibly appreciated.