Recherche avancée

Médias (91)

Autres articles (66)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

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

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (7518)

  • FileNotFoundError when extracting audio from recently saved video using FFMPEG"

    3 août 2023, par Peter Long

    Scenario : I'm using this tool to record tiktok live. I write another script to call the main.pytool because I want to add some additional options, for example, to extract the audio of the live video that is recorded

    


    FFMPEG is used to extract the audio. First the video is saved (with FFMPEG) and after I want to extract the audio of that video (again with FFMPEG). The path where the video is recorded and saved is C:\Users\Administrator\Desktop\tiktok

    


    The problem is that I see the file and it is saved, but this error is generated as output : FileNotFoundError: [WinError 2] The system cannot find the file specified

    


    I can't figure out why it doesn't detect the last saved video file in general

    


    I try with this

    


    import os
import subprocess
import time
from moviepy.editor import VideoFileClip

def main():
    # Command to run main.py and record the video
    cmd = 'python main.py -user ryzebenny -output "C:\\Users\\Administrator\\Desktop\\tiktok" -ffmpeg -duration 30 --auto-convert'
    subprocess.run(cmd, shell=True)

    # Wait for the video file to appear in the folder
    wait_for_video("C:\\Users\\Administrator\\Desktop\\tiktok")

    # Extract audio from recorded video
    video_filename = find_latest_file("C:\\Users\\Administrator\\Desktop\\tiktok", ".mp4")
    if video_filename:
        video_path = os.path.join("C:\\Users\\Administrator\\Desktop\\tiktok", video_filename)
        audio_filename = video_filename.replace(".mp4", ".mp3")
        audio_path = os.path.join("C:\\Users\\Administrator\\Desktop\\tiktok", audio_filename)

        video_clip = VideoFileClip(video_path)
        audio_clip = video_clip.audio
        audio_clip.write_audiofile(audio_path)
        audio_clip.close()
        video_clip.close()
        print(f"Audio extraction completed: {audio_filename}")
    else:
        print("No video files found.")

def wait_for_video(directory):
    max_wait_time = 60  # Maximum time to wait in seconds
    start_time = time.time()
    while time.time() - start_time < max_wait_time:
        if find_latest_file(directory, ".mp4"):
            break
        time.sleep(1)

def find_latest_file(directory, extension):
    list_of_files = [f for f in os.listdir(directory) if f.endswith(extension) and os.path.isfile(os.path.join(directory, f))]
    if list_of_files:
        return max(list_of_files, key=os.path.getctime)
    return None

if __name__ == "__main__":
    main()


    


    but i get this error

    


    [*] 2023-08-03 15:57:09 - INFO - START RECORDING FOR 30 SECONDS&#xA;[*] 2023-08-03 15:57:09 - INFO - [PRESS &#x27;q&#x27; TO STOP RECORDING]&#xA;[*] 2023-08-03 15:57:31 - INFO - FINISH: C:\Users\Administrator\Desktop\tiktok\TK_ryzebenny_2023.08.03_15-57-09_flv.mp4&#xA;&#xA;Traceback (most recent call last):&#xA;  File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 45, in <module>&#xA;    main()&#xA;  File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 12, in main&#xA;    wait_for_video("C:\\Users\\Administrator\\Desktop\\tiktok")&#xA;  File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 34, in wait_for_video&#xA;    if find_latest_file(directory, ".mp4"):&#xA;       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 41, in find_latest_file&#xA;    return max(list_of_files, key=os.path.getctime)&#xA;           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "<frozen genericpath="genericpath">", line 65, in getctime&#xA;FileNotFoundError: [WinError 2] The system cannot find the file specified: &#x27;TK_ryzebenny_2023.08.03_15-57-09.mp4&#x27;&#xA;</frozen></module>

    &#xA;

    Instead, I expect that once I save the video (in .mp4) the audio of that video will be extracted afterwards

    &#xA;

  • lavc/qsvenc_hevc : restore the default gop size

    11 août 2023, par Haihao Xiang
    lavc/qsvenc_hevc : restore the default gop size
    

    commit a3c0a3e changed the default settings and expected the runtime can
    choose a best value. However the runtime doesn't set a valid gop size
    for hevc encoder, hence the output steam is non-seekable, which is
    inconvenient to user [1][2]

    [1] https://github.com/intel/media-driver/issues/1576
    [2] https://ffmpeg.org/pipermail/ffmpeg-user/2023-August/056716.html

    Signed-off-by : Haihao Xiang <haihao.xiang@intel.com>

    • [DH] libavcodec/qsvenc_hevc.c
  • Pydub : How to ave audio after convert it to aac ?

    4 août 2023, par suvodipMondal

    I am using django admin form to recieve a audio input, and I am trying to convert it into aac format with pydub.&#xA;I have installed ffmpeg in my system and also added pydub and ffmpeg-python as dependencies.

    &#xA;

    Here is the django ModelAdmin :

    &#xA;

    class AudioAdmin(admin.ModelAdmin):&#xA;    fields = (&#x27;file&#x27;, &#x27;bit_rate&#x27;, &#x27;format&#x27;)&#xA;    list_display = (&#x27;id&#x27;, &#x27;file&#x27;, &#x27;bit_rate&#x27;, &#x27;format&#x27;, &#x27;content_type&#x27;)&#xA;&#xA;    def save_model(self, request, obj, form, change):&#xA;        audio_file = form.cleaned_data[&#x27;file&#x27;]&#xA;        _, file_extension = os.path.splitext(audio_file.name)&#xA;        curr_audio = AudioSegment.from_file(file=audio_file, format=file_extension.replace(&#x27;.&#x27;, &#x27;&#x27;))&#xA;        new_audio = curr_audio.export(out_f=audio_file.name, format="aac")&#xA;        obj.file = new_audio&#xA;        obj.save()&#xA;&#xA;

    &#xA;

    I am still getting this error while converting an mp3 file in aac format.

    &#xA;

        raise CouldntEncodeError(&#xA;pydub.exceptions.CouldntEncodeError: Encoding failed. ffmpeg/avlib returned error code: 1&#xA;Command:[&#x27;ffmpeg&#x27;, &#x27;-y&#x27;, &#x27;-f&#x27;, &#x27;wav&#x27;, &#x27;-i&#x27;, &#x27;/var/folders/8g/230x9vx55p7c0bdwx0cmzx9r0000gq/T/tmpxaetjjk0&#x27;, &#x27;-f&#x27;, &#x27;aac&#x27;, &#x27;/var/folders/8g/230x9vx55p7c0bdwx0cmzx9r0000gq/T/tmpa3ae8nn1&#x27;]&#xA;Output from ffmpeg/avlib:&#xA;ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers&#xA;  built with Apple clang version 14.0.0 (clang-1400.0.29.202)&#xA;  configuration: --prefix=/usr/local/Cellar/ffmpeg/6.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox&#xA;  libavutil      58.  2.100 / 58.  2.100&#xA;  libavcodec     60.  3.100 / 60.  3.100&#xA;  libavformat    60.  3.100 / 60.  3.100&#xA;  libavdevice    60.  1.100 / 60.  1.100&#xA;  libavfilter     9.  3.100 /  9.  3.100&#xA;  libswscale      7.  1.100 /  7.  1.100&#xA;  libswresample   4. 10.100 /  4. 10.100&#xA;  libpostproc    57.  1.100 / 57.  1.100&#xA;Guessed Channel Layout for Input Stream #0.0 : stereo&#xA;Input #0, wav, from &#x27;/var/folders/8g/230x9vx55p7c0bdwx0cmzx9r0000gq/T/tmpxaetjjk0&#x27;:&#xA;  Duration: 00:03:14.72, bitrate: 1411 kb/s&#xA;  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s&#xA;[NULL @ 0x7fe40da072c0] Requested output format &#x27;aac&#x27; is not a suitable output format&#xA;/var/folders/8g/230x9vx55p7c0bdwx0cmzx9r0000gq/T/tmpa3ae8nn1: Invalid argument&#xA;

    &#xA;