Recherche avancée

Médias (0)

Mot : - Tags -/content

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

Autres articles (48)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

  • Le plugin : Gestion de la mutualisation

    2 mars 2010, par

    Le plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
    Installation basique
    On installe les fichiers de SPIP sur le serveur.
    On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
    On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
    < ?php (...)

  • Qualité du média après traitement

    21 juin 2013, par

    Le bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
    Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...)

Sur d’autres sites (3721)

  • Automate removing segments of a video using ffmpeg-python

    12 décembre 2024, par Hriday NS

    I'm very new to ffmpeg and unable to wrap my head around the concepts entirely. My goal for this little script I've been working on all day is to :

    &#xA;

    Step 1 : Read a list of timestamps from a text file like so :

    &#xA;

    00:00 - 00:14

    &#xA;

    00:30 - 00:45

    &#xA;

    So that works : for me :

    &#xA;

    def read_timestamps(file_path):&#xA;    timestamps = []&#xA;    with open(file_path, &#x27;r&#x27;) as f:&#xA;        for line in f.readlines():&#xA;            match = re.match(r&#x27;(\d{1,2}):(\d{2}) - (\d{1,2}):(\d{2})&#x27;, line.strip())&#xA;            if match:&#xA;                start = int(match.group(1)) * 60 &#x2B; int(match.group(2))  # minutes:seconds -> total seconds&#xA;                end = int(match.group(3)) * 60 &#x2B; int(match.group(4))    # minutes:seconds -> total seconds&#xA;&#xA;                timestamps.append((start, end))&#xA;    return timestamps&#xA;

    &#xA;

    Parsed timestamps : [(0, 14), (30, 45)] --------> CORRECT !

    &#xA;

    Step 2 : Remove or Cut-out those parts from the original video file "input.mkv"

    &#xA;

    Rather, virtually "remember" the segments that are important leaving out the cut-out parts.

    &#xA;

    # Function to split the video based on the timestamps (no intermediate files)&#xA;def split_video(input_file, timestamps):&#xA;    segments = []&#xA;    &#xA;    # Assuming the input file is a long video, and we are removing the timestamp ranges&#xA;    video_duration = ffmpeg.probe(input_file, v="error", select_streams="v:0", show_entries="format=duration")["format"]["duration"]&#xA;    video_duration = float(video_duration)&#xA;&#xA;    # Now we split the video based on the timestamp ranges&#xA;    prev_end = 0&#xA;    for start, end in timestamps:&#xA;        if start &lt; end:&#xA;            # The part we want to keep is from prev_end to the start of the timestamp&#xA;            if prev_end &lt; start:&#xA;                segments.append((prev_end, start))  # Add the segment before the removal range&#xA;            prev_end = end  # After the removal range, the video continues from &#x27;end&#x27;&#xA;        else:&#xA;            print(f"Invalid timestamp range: {start} to {end}. Skipping this range.")&#xA;    &#xA;    # After processing all timestamps, add the remaining part from prev_end to the end of the video&#xA;    if prev_end &lt; video_duration:&#xA;        segments.append((prev_end, video_duration))  # Last segment to the end of the video&#xA;&#xA;    return segments&#xA;&#xA;

    &#xA;

    So for the above input, I correctly get the segments :

    &#xA;

    Segments : [(14, 30), (45, 2379.784)] -------------> CORRECT ! (yes, input video is 39+ mins long)

    &#xA;

    Step 3 : From the rest of the video clips that remain, I wanted to concatenate them all into a single "output.mp4", while ensuring that :

    &#xA;

    a. the concatenated video tracks transition with a cross-dissolve (or xfade in ffmpeg ?)

    &#xA;

    b. the concatenated audio tracks transition with a cross-fade (or afade in ffmpeg ?)

    &#xA;

    I was trying to see if hardcoded values worked because none of my loops were working and I was shooting in the dark. Atleast if I can get the hardcoded version to work, I can reverse-engineer a loop for it :

    &#xA;

    &#xA;def concatenate_with_crossfade(input_file, segments, output_file):&#xA;    # Video inputs for two segments (start, end)&#xA;    input_video_1 = ffmpeg.input(input_file, ss=14, to=30)  # Segment 1 video&#xA;    input_audio_1 = ffmpeg.input(input_file, ss=14, to=30)  # Segment 1 audio&#xA;&#xA;    input_video_2 = ffmpeg.input(input_file, ss=45, to=1000)  # Segment 2 video&#xA;    input_audio_2 = ffmpeg.input(input_file, ss=45, to=1000)  # Segment 2 audio&#xA;&#xA;&#xA;    filter_complex_str = (&#xA;        "[0:v][1:v]xfade=transition=fade:duration=1:offset=4[v1];"  # Crossfade between video&#xA;        "[0:a]afade=type=out:duration=1:start_time=30[a1];"         # Fade-out for first audio&#xA;        "[1:a]afade=type=in:duration=1:start_time=0[a2];"            # Fade-in for second audio&#xA;        "[v1][a1][a2]concat=n=1:v=1:a=1[outv][outa]"                 # Concatenate the results&#xA;    )&#xA;&#xA;    # Pass the filter_complex to the ffmpeg command&#xA;    ffmpeg.output(input_video_1, input_video_2, input_audio_1, input_audio_2, output_file,&#xA;                vcodec="libx264", acodec="aac", audio_bitrate="192k", &#xA;                filter_complex=filter_complex_str, shortest=None).run()&#xA;&#xA;# Main script&#xA;def main():&#xA;    input_file = &#x27;input.mkv&#x27;&#xA;    timestamps_file = &#x27;timestamps.txt&#x27;&#xA;    output_file = &#x27;output.mp4&#x27;&#xA;&#xA;    # Step 1: Read the timestamps&#xA;    timestamps = read_timestamps(timestamps_file)&#xA;    print(f"Parsed timestamps: {timestamps}")&#xA;&#xA;    # Step 2: Split the video into segments based on the timestamps&#xA;    segments = split_video(input_file, timestamps)&#xA;    print(f"Segments to keep: {segments}")&#xA;&#xA;    # Step 3: Concatenate with crossfade&#xA;    concatenate_with_crossfade(input_file, segments, output_file)&#xA;&#xA;    print(f"Output saved to {output_file}")&#xA;&#xA;# Run the script&#xA;if __name__ == "__main__":&#xA;    main()&#xA;&#xA;

    &#xA;

    Problems :

    &#xA;

    Throughout Step 3, all my attemps have been getting issues like :

    &#xA;

    [AVFilterGraph @ 0000013bf9904e80] More input link labels specified for filter &#x27;concat&#x27; than it has inputs: 3 > 2&#xA;[AVFilterGraph @ 0000013bf9904e80] Error linking filters&#xA;Failed to set value &#x27;[0:v][1:v]xfade=transition=fade:duration=1:offset=4[v1];[0:a]afade=type=out:duration=1:start_time=30[a1];[1:a]afade=type=in:duration=1:start_time=0[a2];[v1][a1][a2]concat=n=1:v=1:a=1[outv][outa]&#x27; for option &#x27;filter_complex&#x27;: Invalid argument&#xA;Error parsing global options: Invalid argument&#xA;

    &#xA;

    OR

    &#xA;

    [fc#0 @ 000001c1203d4ac0] Filter xfade:default has an unconnected output&#xA;Error binding filtergraph inputs/outputs: Invalid argument&#xA;

    &#xA;

    OR

    &#xA;

    [AVFilterGraph @ 0000023dd82e4e80] More input link labels specified for filter &#x27;concat&#x27; than it has inputs: 3 > 2&#xA;[AVFilterGraph @ 0000023dd82e4e80] Error linking filters&#xA;Failed to set value &#x27;[0:v][1:v]xfade=transition=fade:duration=1:offset=4[v1];[0:a]afade=type=out:duration=1:start_time=30[a1];[1:a]afade=type=in:duration=1:start_time=0[a2];[v1][a1][a2]concat=n=1:v=1:a=1[outv][outa]&#x27; for option &#x27;filter_complex&#x27;: Invalid argument&#xA;Error parsing global options: Invalid argument&#xA;

    &#xA;

    OR

    &#xA;

    [aist#0:1/aac @ 000001b549c7bd00] Cannot decode a disabled input stream&#xA;[fc#0 @ 000001b549c748c0] Error binding an input stream to complex filtergraph input afade:default.&#xA;Error binding filtergraph inputs/outputs: Invalid argument&#xA;

    &#xA;

    And I'm at a loss. Can anyone spot a mistake in the hardcoded filtergraph in the string filter_complex_str in step 3 - because I'm 90% sure I am messing that up in some way ? I would really appreciate your help on the matter ! Thank you !

    &#xA;

  • Having issues making an app with py2app ffmpeg and ffprobe

    23 septembre 2024, par Nuno Mesquita

    I have made an app in OSX Python, that uses FFMEG and ffprobe.

    &#xA;

    It runs fine in my VS Code.

    &#xA;

    I want to make a self sustained app, that others can use, without needed to install anything themselves. So, I manually included the static libraries in the bin folder of my main app, and am able to run the app using the libraries inside my bin folder.

    &#xA;

    I have lost many hours trying to figure this out, and am always getting the same error.

    &#xA;

    My best shot was being able to open the app inside app/contents/resources and running via Python, but still have the issue saying that ffprobe is not available.

    &#xA;

    I´m losing my mind...

    &#xA;

    Should I try a completely different approach ?

    &#xA;

    For now, I just want my OSX friends to be able to use the app, then I will want it to run on Windows too, but baby steps.

    &#xA;

    I am not quite sure what to include in setup.py, so I would love to include everything that is in my app folder, to avoid all sorts of errors in missing .pngs and stuff.

    &#xA;

    I also made sure that libraries are executable (they are about 80MB each (ffmpeg and ffprobe))

    &#xA;

    Can anyone help =D ???

    &#xA;

    I described above, tested different ways, checked stuff like redirecting the libraries to the folders of the app :

    &#xA;

    For the last try my setup.py was :

    &#xA;

    from setuptools import setup&#xA;&#xA;APP = [&#x27;mpc.py&#x27;]&#xA;DATA_FILES = [&#xA;    (&#x27;bin&#x27;, [&#x27;./bin/ffmpeg&#x27;, &#x27;./bin/ffprobe&#x27;]),&#xA;    (&#x27;theme/dark&#x27;, [&#x27;./theme/dark/*.png&#x27;]),&#xA;    (&#x27;theme/light&#x27;, [&#x27;./theme/light/*.png&#x27;]),&#xA;    (&#x27;theme&#x27;, [&#x27;./theme/dark.tcl&#x27;, &#x27;./theme/light.tcl&#x27;]),&#xA;    &#x27;.&#x27;,  # Add current directory to ensure everything is included&#xA;]&#xA;&#xA;OPTIONS = {&#xA;    &#x27;argv_emulation&#x27;: False,&#xA;    &#x27;packages&#x27;: [&#x27;pydub&#x27;, &#x27;pygame&#x27;, &#x27;requests&#x27;, &#x27;freesound&#x27;],&#xA;    &#x27;includes&#x27;: [&#x27;pydub&#x27;, &#x27;pygame&#x27;, &#x27;requests&#x27;, &#x27;freesound&#x27;],&#xA;    &#x27;resources&#x27;: [&#x27;./bin/ffmpeg&#x27;, &#x27;./bin/ffprobe&#x27;, &#x27;./theme/dark/*.png&#x27;, &#x27;./theme/light/*.png&#x27;,     &#x27;./theme/dark.tcl&#x27;, &#x27;./theme/light.tcl&#x27;],&#xA;}&#xA;&#xA;setup(&#xA;    app=APP,&#xA;    data_files=DATA_FILES,&#xA;    options={&#x27;py2app&#x27;: OPTIONS},&#xA;    setup_requires=[&#x27;py2app&#x27;],&#xA;)&#xA;

    &#xA;

    And I also had this in the beginning of my Python script :

    &#xA;

    # Set ffmpeg and ffprobe paths relative to the app&#x27;s Resources/bin directory&#xA;app_dir = os.path.dirname(os.path.abspath(__file__)) &#xA;&#xA;# Set ffmpeg and ffprobe paths relative to the app&#x27;s Resources/bin directory&#xA;ffmpeg_path = os.path.join(app_dir, &#x27;bin&#x27;, &#x27;ffmpeg&#x27;)&#xA;ffprobe_path = os.path.join(app_dir, &#x27;bin&#x27;, &#x27;ffprobe&#x27;) &#xA;AudioSegment.converter = ffmpeg_path&#xA;AudioSegment.ffprobe = ffprobe_path&#xA;

    &#xA;

    Don't know what else to try.

    &#xA;

  • FFMPEG G711ulaw Rhythmic Distortion [closed]

    8 juillet 2024, par nsd123

    I am using ffmpeg take audio in from my microphone, rtp stream it to a multicast address as g711ulaw audio, and then play that audio through various devices.

    &#xA;

    In my network I have other workstations, as well as a digital telephone type device.&#xA;My workstations are using Windows.

    &#xA;

    I am taking the microphone input with this ffmpeg command :&#xA;ffmpeg -f dshow -i audio="" -pcm_mulaw -ab 64k -ac 1 -ar 8000 -f rtp rtp :// : ?localaddr=

    &#xA;

    This command transmits the microphone data successfully to other workstations on the network, where I can use ffplay or other means to listen to the rtp stream and hear clear audio.

    &#xA;

    On the telephone device, when it gets converted to analog to play, it's picking up this strange, rhythmic burp/clicking/noise, like every time its getting information, its interpreting the header as voice data or something.

    &#xA;

    The output of the ffmpeg command says the pcm_s16le codec is the native one, and seems to convert it just fine.

    &#xA;

    Is there any kind of option I should be using in my ffmpeg command that sounds like it could resolve this issue ? Or does this kind of interference typically occur for a specific reason ?

    &#xA;

    Its not the hardware, I've tested that (other audio able to play clearly).&#xA;I've tried a few other codecs to no success.&#xA;I've tried a few ffmpeg options, but there are so many options, they've just been successful stabs in the dark

    &#xA;