Recherche avancée

Médias (0)

Mot : - Tags -/flash

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (58)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • MediaSPIP Core : La Configuration

    9 novembre 2010, par

    MediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
    Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (10298)

  • FFmpeg error while converting from MP4 to MP3 in Python

    4 février 2024, par Jack142

    When I try to convert videos from a YouTube playlist, it gives me an error :

    


    


    File "C :\Users\fonti\AppData\Local\Programs\Python\Python310\lib\site-packages\ffmpy.py", line 106, in run
raise FFRuntimeError(self.cmd, self.process.returncode, out[0], out[1])
ffmpy.FFRuntimeError : C:/ffmpeg/bin/ffmpeg.exe -i "Nightcore - To Be Human // lyrics.mp4" "Nightcore - To Be Human // lyrics.mp3" exited with status 1

    


    


    The code I'm using :

    


    from pytube import Playlist
import ffmpy
from ffmpy import FFmpeg

playlistLink = input("Introduz o link da Playlist: ")
playlist = Playlist(playlistLink)   

diretório = 'E'
while diretório != 'M' and diretório != 'V':
    diretório = input("Vais baixar música ou vídeos? (M/V)")
    if diretório == 'M':
        downloadDirectory = "C:/Users/fonti/Documents/Projetos Python/Youtube/Músicas"
    elif diretório == 'V':
        downloadDirectory = "C:/Users/fonti/Documents/Projetos Python/Youtube/Vídeos"

print("Número total de vídeos a baixar: ", len(playlist.video_urls))    

print("\n\n Links dos vídeos:\n")

for url in playlist.video_urls:
    print(url) 

def MP3():
    for video in playlist.videos:

        audio = video.streams.get_audio_only()
    
        audio.download(downloadDirectory)

        videoTitle = video.title
    
        new_filename = videoTitle + '.mp3'
        default_filename = videoTitle + '.mp4'
    
        print(default_filename+'\n\n'+new_filename)

        ff = ffmpy.FFmpeg(
            executable = 'C:/ffmpeg/bin/ffmpeg.exe',
            inputs={default_filename : None},
            outputs={new_filename : None}
        )
        ff.run()


def MP4():
    for video in playlist.videos:
        print('Downloading : {} with url : {}'.format(video.title, video.watch_url))
        video.streams.\
            filter(type='video', progressive=True, file_extension='mp4').\
            order_by('resolution').\
            desc().\
            first().\
            download(downloadDirectory)

escolha = 'E'
while escolha != 'V' and escolha != 'A':
    escolha = input("Queres formato de vídeo ou áudio (V/A)? ")
    if escolha == 'V':
        MP4()
    elif escolha == 'A':
        MP3()
    else:
        print("Escolha inválida")


    


    If I try to download the videos from the playlist, it works fine. But when I try to download the audios, it gives me the error.

    


  • Programmatically accessing PTS times in MP4 container

    9 novembre 2022, par mcandril

    Background

    


    For a research project, we are recording video data from two cameras and feed a synchronization pulse directly into the microphone ADC every second.

    


    Problem

    


    We want to derive a frame time stamp in the clock of the pulse source for each camera frame to relate the camera images temporally. With our current methods (see below), we get a frame offset of around 2 frames between the cameras. Unfortunately, inspection of the video shows that we are clearly 6 frames off (at least at one point) between the cameras.
I assume that this is because we are relating audio and video signal wrong (see below).

    


    Approach I think I need help with

    


    I read that in the MP4 container, there should be PTS times for video and audio. How do we access those programmatically. Python would be perfect, but if we have to call ffmpeg via system calls, we may do that too ...

    


    What we currently fail with

    


    The original idea was to find video and audio times as

    


    audio_sample_times = range(N_audiosamples)/audio_sampling_rate
video_frame_times = range(N_videoframes)/video_frame_rate


    


    then identify audio_pulse_times in audio_sample_times base, calculate the relative position of each video_time to the audio_pulse_times around it, and select the same relative value to the corresponding source_pulse_times.

    


    However, a first indication that this approach is problematic is already that for some videos, N_audiosamples/audio_sampling_rate differs from N_videoframes/video_frame_rate by multiple frames.

    


    What I have found by now

    


    OpenCV's cv2.CAP_PROP_POS_MSEC seems to do exactly what we do, and not access any PTS ...

    


    Edit : What I took from the winning answer

    


    container = av.open(video_path)
signal = []
audio_sample_times = []
video_sample_times = []

for frame in tqdm(container.decode(video=0, audio=0)):
    if isinstance(frame, av.audio.frame.AudioFrame):
        sample_times = (frame.pts + np.arange(frame.samples)) / frame.sample_rate
        audio_sample_times += list(sample_times)
        signal_f_ch0 = frame.to_ndarray().reshape((-1, len(frame.layout.channels))).T[0]
        signal += list(signal_f_ch0)
    elif isinstance(frame, av.video.frame.VideoFrame):
        video_sample_times.append(float(frame.pts*frame.time_base))

signal = np.abs(np.array(signal))
audio_sample_times = np.array(audio_sample_times)
video_sample_times = np.array(video_sample_times)


    


    Unfortunately, in my particular case, all pts are consecutive and gapless, so the result is the same as with the naive solution ...
By picture clues, we identified a section of 10s in the videos, somewhere in which they desync, but can't find any traces of that in the data.

    


  • ffmpeg output gives file not found error in python

    20 octobre 2022, par Batuhan Yılmaz

    Trying to build an auto subtitled video generator in Python. But couldn't generate the subtitled video of the input video using ffmpeg. Getting an error saying there is no output.mp4. FileNotFoundError : [Errno 2] No such file or directory : 'C :\Users\batuh\Desktop\auto-multipage\output.mp4'

    


    Can you help me out ? Full code is here : https://github.com/BatuhanYilmaz26/auto-sub-exp/blob/main/pages/02_up3.py

    


    Here's the parts where I used ffmpeg :

    


    def inferecence(loaded_model, uploaded_file, task):
    with open(f"{save_dir}/audio.mp3" , "wb") as f:
            f.write(uploaded_file.read())
        audio = ffmpeg.input(f"{save_dir}/audio.mp3")
        audio = ffmpeg.output(audio, f"{save_dir}/output.wav", acodec="pcm_s16le", ac=1, ar="16k")
        ffmpeg.run(audio, overwrite_output=True)
    if task == "Transcribe":
            options = dict(task="transcribe", best_of=5)
            results = loaded_model.transcribe(f"{save_dir}/output.wav", **options)
            vtt = getSubs(results["segments"], "vtt", 80)
            srt = getSubs(results["segments"], "srt", 80)
            lang = results["language"]
    return results["text"], vtt, srt, lang
    elif task == "Translate":
            options = dict(task="translate", best_of=5)
            results = loaded_model.transcribe(f"{save_dir}/output.wav", **options)
            vtt = getSubs(results["segments"], "vtt", 80)
            srt = getSubs(results["segments"], "srt", 80)
            lang = results["language"]
    return results["text"], vtt, srt, lang
    else:
    raise ValueError("Task not supported")
    
    results = inferecence(loaded_model, input_file, task)
    
    subprocess.run(shlex.split(f"ffmpeg -i {save_dir}/input.mp4 -i {save_dir}/output.wav -i transcript.srt -c:v copy -c:a copy -c:s copy -map 0:a -map 1:v -map 2:s -metadata:s:a:0 language={results[3]} -y {save_dir}/output.mp4"))
    #subprocess.run(shlex.split(f"ffmpeg -i {save_dir}/input.mp4 -vf {save_dir}/transcript.srt -y {save_dir}/output.mp4"))
    with open(os.path.join(os.getcwd(), "output.mp4"), "rb") as f:
                        data = f.read()
                    st.video(data)
                    st.download_button(label="Download Subtitled Video",
                                        data=data,
                                        file_name="output.mp4")


    


    sorry about the indentations

    


    Logfile :

    


    ffmpeg started on 2022-10-20 at 23:43:53
Report written to "ffmpeg-20221020-234353.log"
Command line:
ffmpeg -i C:UsersbatuhDesktopauto-multipagepageslocaloutput/input.mp4 -i C:UsersbatuhDesktopauto-multipagepageslocaloutput/output.wav -i transcript.srt -c:v copy -c:a copy -c:s copy -map 0:a -map 1:v -map 2:s -metadata:s:a:0 "language=eng" -y C:UsersbatuhDesktopauto-multipagepageslocaloutput/output.mp4 -report
ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200523
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'C:UsersbatuhDesktopauto-multipagepageslocaloutput/input.mp4'.
Reading option '-i' ... matched as input url with argument 'C:UsersbatuhDesktopauto-multipagepageslocaloutput/output.wav'.
Reading option '-i' ... matched as input url with argument 'transcript.srt'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-c:s' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '1:v'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '2:s'.
Reading option '-metadata:s:a:0' ... matched as option 'metadata' (add metadata) with argument 'language=eng'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option 'C:UsersbatuhDesktopauto-multipagepageslocaloutput/output.mp4' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url C:UsersbatuhDesktopauto-multipagepageslocaloutput/input.mp4.
Successfully parsed a group of options.
Opening an input file: C:UsersbatuhDesktopauto-multipagepageslocaloutput/input.mp4.
[NULL @ 000001fba186b9c0] Opening 'C:UsersbatuhDesktopauto-multipagepageslocaloutput/input.mp4' for reading
[file @ 000001fba186c140] Setting default whitelist 'file,crypto'
C:UsersbatuhDesktopauto-multipagepageslocaloutput/input.mp4: No such file or directory