Recherche avancée

Médias (1)

Mot : - Tags -/publishing

Autres articles (92)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

Sur d’autres sites (17003)

  • Video streaming error : Uncaught (in promise) NotSupportedError : Failed to load because no supported source was found

    18 septembre 2024, par Aizen

    Here is my problem : I have one video src 1080p (on the frontend). On the frontend, I send this video-route to the backend :

    


    const req = async()=>{try{const res = await axios.get('/catalog/item',{params:{SeriesName:seriesName}});return {data:res.data};}catch(err){console.log(err);return false;}}const fetchedData = await req();-On the backend i return seriesName.Now i can make a full path,what the video is,and where it is,code:


    


    const videoUrl = 'C:/Users/arMori/Desktop/RedditClone/reddit/public/videos';console.log('IT VideoURL',videoUrl);


    


    const selectedFile = `${videoUrl}/${fetchedData.data.VideoSource}/${seriesName}-1080p.mp4`
console.log(`ITS'S SELECTED FILE: ${selectedFile}`);


    


    Ok, I have my src 1080p, now is the time to send it to the backend :

    


    const response = await axios.post('/videoFormat', {videoUrl:selectedFile})console.log('Это консоль лог путей: ',response.data);const videoPaths = response.data;


    


    Backend takes it and FFMpqg makes two types of resolution,720p and 480p,save it to the temp storage on backend, and then returns two routes where these videos stores

    


    async videoUpload(videoUrl:string){try{const tempDir = C:/Users/arMori/Desktop/RedditClone/reddit_back/src/video/temp;const inputFile = videoUrl;console.log('VIDEOURL: ',videoUrl);


    


            const outputFiles = [];&#xA;        &#xA;        await this.createDirectories(tempDir);        &#xA;        outputFiles.push(await this.convertVideo(inputFile, &#x27;1280x720&#x27;, &#x27;720p.mp4&#x27;));&#xA;        outputFiles.push(await this.convertVideo(inputFile, &#x27;854x480&#x27;, &#x27;480p.mp4&#x27;));&#xA;        console.log(&#x27;OUTUPT FILES SERVICE: &#x27;,outputFiles);&#xA;        &#xA;        return outputFiles;&#xA;&#xA;    }catch(err){&#xA;        console.error(&#x27;VideoFormatterService Error: &#x27;,err);&#xA;        &#xA;    }&#xA;}&#xA;&#xA;private convertVideo(inputPath:string,resolution:string,outputFileName:string):Promise<string>{&#xA;    const temp = `C:/Users/arMori/Desktop/RedditClone/reddit_back/src/video/temp`;&#xA;    return new Promise(async(resolve,reject)=>{&#xA;        const height = resolution.split(&#x27;x&#x27;)[1];&#xA;        console.log(&#x27;HIEGHT: &#x27;,height);&#xA;        &#xA;        const outputDir = `C:/Users/arMori/Desktop/RedditClone/reddit_back/src/video/temp/${height}p`;&#xA;        const outputPath = join(outputDir, outputFileName);&#xA;        const isExists = await fs.access(outputPath).then(() => true).catch(() => false);&#xA;        if(isExists){ &#xA;            console.log(`File already exists: ${outputPath}`);&#xA;            return resolve(outputPath)&#xA;        };&#xA;        ffmpeg(inputPath)&#xA;        .size(`${resolution}`)&#xA;        .videoCodec(&#x27;libx264&#x27;) // Кодек H.264&#xA;        .audioCodec(&#x27;aac&#x27;) &#xA;        .output(outputPath)&#xA;        .on(&#x27;end&#x27;,()=>resolve(outputPath))&#xA;        .on(&#x27;error&#x27;,(err)=>reject(err))&#xA;        .run()&#xA;            &#xA;    })&#xA;}&#xA;&#xA;private async createDirectories(temp:string){&#xA;    try{&#xA;        const dir720p = `${temp}/720p`;&#xA;        const dir480p = `${temp}/480p`;&#xA;        const dir720pExists = await fs.access(dir720p).then(() => true).catch(() => false);&#xA;        const dir480pExists = await fs.access(dir480p).then(() => true).catch(() => false);&#xA;        if(dir720pExists &amp;&amp; dir480pExists){&#xA;            console.log(&#x27;FILES ALIVE&#x27;);&#xA;            return;&#xA;        }&#xA;        if (!dir720pExists) {&#xA;            await fs.mkdir(dir720p, { recursive: true });&#xA;            console.log(&#x27;Папка 720p создана&#x27;);&#xA;        }&#xA;        &#xA;        if (!dir480pExists) {&#xA;            await fs.mkdir(dir480p, { recursive: true });&#xA;            console.log(&#x27;Папка 480p создана&#x27;);&#xA;        }&#xA;    } catch (err) {&#xA;        console.error(&#x27;Ошибка при создании директорий:&#x27;, err);&#xA;    }&#xA;}&#xA;</string>

    &#xA;

    Continue frontentd code :

    &#xA;

    let videoPath;&#xA;&#xA;if (quality === &#x27;720p&#x27;) {&#xA;        videoPath = videoPaths[0];&#xA;} else if (quality === &#x27;480p&#x27;) {&#xA;        videoPath = videoPaths[1];&#xA;}&#xA;&#xA;if (!videoPath) {&#xA;        console.error(&#x27;Video path not found!&#x27;);&#xA;        return;&#xA;}&#xA;&#xA;// Получаем видео по его пути&#xA;console.log(&#x27;VIDEOPATH LOG: &#x27;,videoPath);&#xA;    &#xA;const videoRes = await axios.get(&#x27;/videoFormat/getVideo&#x27;, { &#xA;        params: { path: videoPath } ,&#xA;        headers: { Range: &#x27;bytes=0-&#x27; },&#xA;        responseType: &#x27;blob&#x27;&#xA;    });&#xA;    console.log(&#x27;Video fetched: &#x27;, videoRes);&#xA;    const videoBlob = new Blob([videoRes.data], { type: &#x27;video/mp4&#x27; });&#xA;    const videoURL = URL.createObjectURL(videoBlob);&#xA;    return videoURL;&#xA;    /* console.log(&#x27;Видео успешно загружено:&#x27;, response.data); */&#xA;    } catch (error) {&#xA;    console.error(&#x27;Ошибка при загрузке видео:&#x27;, error);&#xA;    }&#xA;}&#xA;

    &#xA;

    Here I just choose one of the route and make a new GET request (VideoRes), now in the controller in the backend, I'm trying to do a video streaming :

    &#xA;

    @Public()&#xA;    @Get(&#x27;/getVideo&#x27;)&#xA;    async getVideo(@Query(&#x27;path&#x27;) videoPath:string,@Req() req:Request,@Res() res:Response){&#xA;        try {&#xA;            console.log(&#x27;PATH ARGUMENT: &#x27;,videoPath);&#xA;            console.log(&#x27;VIDEOPATH IN SERVICE: &#x27;,videoPath);&#xA;        const videoSize = (await fs.stat(videoPath)).size;&#xA;        const CHUNK_SIZE = 10 ** 6;&#xA;        const range = req.headers[&#x27;range&#x27;] as string | undefined;&#xA;        if (!range) {&#xA;            return new ForbiddenException(&#x27;Range не найденно&#x27;);&#xA;        }&#xA;        const start = Number(range.replace(/\D/g,""));&#xA;        const end = Math.min(start &#x2B; CHUNK_SIZE,videoSize - 1);&#xA;&#xA;        const contentLength = end - start &#x2B; 1;&#xA;        const videoStream = fsSync.createReadStream(videoPath, { start, end });&#xA;        const headers = {&#xA;            &#x27;Content-Range&#x27;:`bytes ${start}-${end}/${videoSize}`,&#xA;            &#x27;Accept-Ranges&#x27;:&#x27;bytes&#x27;,&#xA;            &#x27;Content-Length&#x27;:contentLength,&#xA;            &#x27;Content-Type&#x27;:&#x27;video/mp4&#x27;&#xA;        }&#xA;        &#xA;        res.writeHead(206,headers);&#xA;&#xA;        // Передаем поток в ответ&#xA;        videoStream.pipe(res);&#xA;        &#xA;&#xA;        // Если возникнет ошибка при стриминге, логируем ошибку&#xA;        videoStream.on(&#x27;error&#x27;, (error) => {&#xA;            console.error(&#x27;Ошибка при чтении видео:&#x27;, error);&#xA;            res.status(500).send(&#x27;Ошибка при чтении видео&#x27;);&#xA;        });&#xA;        } catch (error) {&#xA;            console.error(&#x27;Ошибка при обработке запросов:&#x27;, error);&#xA;            return res.status(400).json({ message: &#x27;Ошибка при обработке getVideo запросов&#x27; });&#xA;        }&#xA;    }&#xA;

    &#xA;

    Send to the frontend

    &#xA;

    res.writeHead(206,headers);&#xA;

    &#xA;

    In the frontend, I make blob url for video src and return it

    &#xA;

    const videoBlob = new Blob([videoRes.data], { type: &#x27;video/mp4&#x27; });const videoURL = URL.createObjectURL(videoBlob);return videoURL;&#xA;

    &#xA;

    And assign src to the video :

    &#xA;

    useVideo(seriesName,quality).then(src => {&#xA;                if (src) {&#xA;                    console.log(&#x27;ITS VIDEOLOGISC GOIDA!&#x27;);&#xA;                    if(!playRef.current) return;&#xA;                    &#xA;                    const oldURL = playRef.current.src;&#xA;                    if (oldURL &amp;&amp; oldURL.startsWith(&#x27;blob:&#x27;)) {&#xA;                        URL.revokeObjectURL(oldURL);&#xA;                    }&#xA;                    playRef.current.pause();&#xA;                    playRef.current.src = &#x27;&#x27;;&#xA;                    setQuality(quality);&#xA;                    console.log(&#x27;SRC: &#x27;,src);&#xA;                    &#xA;                    playRef.current.src = src;&#xA;                    playRef.current.load();&#xA;                    console.log(&#x27;ITS VIDEOURL GOIDA!&#x27;);&#xA;                    togglePlayPause();&#xA;                }&#xA;            })&#xA;            .catch(err => console.error(&#x27;Failed to fetch video&#x27;, err));&#xA;

    &#xA;

    But the problem is :

    &#xA;

    &#xA;

    Vinland-Saga:1 Uncaught (in promise) NotSupportedError : Failed to load because no supported source was found

    &#xA;

    &#xA;

    And I don't know why...

    &#xA;

    I tried everything, but I don't understand why src is incorrect..

    &#xA;

  • ffmpeg "Header Missing" error recoding mp3 files

    26 juin 2012, par Jonathan Coe

    I have an mp3 encoding server running on Ubuntu (natty). This has been working perfectly up until maybe a week or two ago. I believe I ran an update, which seemed to break the encoder for me - every time I try to run the encode script, it fails out with the error "Header Missing". Files that encoded previously without any issues no longer encode.

    I am getting the following output when I run a basic ffmpeg script (that worked fine previously). Any ideas what is going on ?

    FFmpeg version 0.6.6-4:0.6.6-0ubuntu0.11.04.1, Copyright (c) 2000-2010 the Libav developers
     built on Jun 12 2012 16:28:21 with gcc 4.5.2
     configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
     WARNING: library configuration mismatch
     libavutil   configuration: --extra-version=4:0.6.6-1ubuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
     libavcodec  configuration: --extra-version=4:0.6.6-1ubuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
     libavformat configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
     libavdevice configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
     libavfilter configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
     libswscale  configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
     libpostproc configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
     libavutil     50.15. 1 / 50.15. 1
     libavcodec    52.72. 2 / 52.72. 2
     libavformat   52.64. 2 / 52.64. 2
     libavdevice   52. 2. 0 / 52. 2. 0
     libavfilter    1.19. 0 /  1.19. 0
     libswscale     0.11. 0 /  0.11. 0
     libpostproc   51. 2. 0 / 51. 2. 0
    [mp3 @ 0x8aafbc0]max_analyze_duration reached
    Input #0, mp3, from &#39;1340299085b3da8484f1b089d28460930d1467a749.mp3&#39;:
     Metadata:
       TLAN            : eng
       TRCK            : 8/11
       TPE1            : Big Wreck
       TALB            : Albatross
       TYER            : 2012
       TIT2            : Rest Of The World
       Rip date        : 2012-03-07
       TDAT            : 0603
       Source          : CD
       Release type    : Normal release
       TCON            : Rock
       TPUB            : Anthem Entertainment Group
     Duration: 00:02:51.38, start: 0.000000, bitrate: 320 kb/s
       Stream #0.0: Audio: mp3, 44100 Hz, 2 channels, s16, 320 kb/s
    File &#39;test.mp3&#39; already exists. Overwrite ? [y/N] y
    Output #0, mp3, to &#39;test.mp3&#39;:
     Metadata:
       TSSE            : Lavf52.64.2
       Stream #0.0: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 64 kb/s
    Stream mapping:
     Stream #0.0 -> #0.0
    Press [q] to stop encoding
    [mp3 @ 0x8ab0db0]Header missingrate=  64.0kbits/s    
    Error while decoding stream #0.0
    size=    1339kB time=171.42 bitrate=  64.0kbits/s    
    video:0kB audio:1339kB global headers:0kB muxing overhead 0.002406%
  • Failed to add audio to mp4 with moviepy

    24 avril, par D G

    I generated an audio sound.wav and a video temp.mp4 that makes use of the audio. Both with the same duration.

    &#xA;

    I got the following warning when generating the temp.mp4. The animation is out of sync, it means that it freezes before the audio finishes.

    &#xA;

    &#xA;

    .venv\Lib\site-packages\moviepy\video\io\ffmpeg_reader.py:178 : UserWarning : In file temp.mp4, 1080000 bytes wanted but 0&#xA;bytes read at frame index 299 (out of a total 300 frames), at time 4.98/5.00 sec. Using the last valid frame instead.&#xA;warnings.warn(

    &#xA;

    &#xA;

    Complete code :

    &#xA;

    # to generate sound.wav&#xA;import numpy as np&#xA;import soundfile as sf&#xA;from tqdm import tqdm&#xA;from os import startfile&#xA;&#xA;# Parameters&#xA;filename = "sound.wav"&#xA;duration = 5  # seconds&#xA;num_voices = 1000&#xA;sample_rate = 44100  # Hz&#xA;chunk_size = sample_rate  # write in 1-second chunks&#xA;&#xA;&#xA;t = np.linspace(0, duration, int(sample_rate * duration), endpoint=False)&#xA;&#xA;# Create many detuned sine waves (Deep Note style)&#xA;start_freqs = np.random.uniform(100, 400, num_voices)&#xA;end_freqs = np.linspace(400, 800, num_voices)  # target harmony&#xA;&#xA;# Each voice sweeps from start to end frequency&#xA;signal = np.zeros_like(t)&#xA;for i in range(num_voices):&#xA;    freqs = np.linspace(start_freqs[i], end_freqs[i], t.size)&#xA;    voice = np.sin(2 * np.pi * freqs * t)&#xA;    voice *= np.sin(np.pi * i / num_voices)  # slight variance&#xA;    signal &#x2B;= voice&#xA;&#xA;# Volume envelope&#xA;envelope = np.linspace(0.01, 1.0, t.size)&#xA;signal *= envelope&#xA;&#xA;# Normalize&#xA;signal /= np.max(np.abs(signal))&#xA;&#xA;# Save with progress bar using soundfile&#xA;with sf.SoundFile(&#xA;    filename, "w", samplerate=sample_rate, channels=1, subtype="PCM_16"&#xA;) as f:&#xA;    for i in tqdm(range(0, len(signal), chunk_size), desc=f"Saving {filename}"):&#xA;        f.write(signal[i : i &#x2B; chunk_size])&#xA;&#xA;&#xA;startfile(filename)&#xA;

    &#xA;

    # to generate temp.mp4&#xA;from numpy import pi, sin, cos&#xA;import matplotlib.pyplot as plt&#xA;from matplotlib.animation import FuncAnimation&#xA;from os import startfile&#xA;from tqdm import tqdm&#xA;from moviepy import VideoFileClip, AudioFileClip, CompositeAudioClip&#xA;&#xA;# Output settings&#xA;filename = "temp.mp4"&#xA;duration = 5  # seconds of animation&#xA;maxdim = 4  # canvas size in plot units (scaled)&#xA;fps = 60&#xA;&#xA;# Real-world parameters&#xA;r = 40  # km (radius)&#xA;endtime = 2  # hours (duration of real motion)&#xA;rph = 0.5  # rotations per hour&#xA;omega = 2 * pi * rph  # rad/hour&#xA;speed = omega * r  # km/hour&#xA;&#xA;# Animation setup&#xA;frames = duration * fps&#xA;scale = maxdim / r  # scale from km to plot units&#xA;dt = endtime / frames  # time per frame in hours&#xA;&#xA;# Prepare figure and axes&#xA;fig, ax = plt.subplots(figsize=(6, 6))&#xA;ax.set_xlim(-maxdim - 1, maxdim &#x2B; 1)&#xA;ax.set_ylim(-maxdim - 1, maxdim &#x2B; 1)&#xA;ax.set_aspect("equal")&#xA;ax.grid()&#xA;&#xA;&#xA;&#xA;# Plot circle path&#xA;circle = plt.Circle((0, 0), r * scale, color="lightgray", fill=False, linestyle="--")&#xA;ax.add_patch(circle)&#xA;&#xA;# Moving point&#xA;(point,) = ax.plot([], [], "ro")&#xA;&#xA;# Info text at center of the circle&#xA;info_text = ax.text(&#xA;    0, 0, "", fontsize=10,&#xA;    ha="center", va="center",&#xA;    bbox=dict(boxstyle="round,pad=0.4", facecolor="white", alpha=0.8)&#xA;)&#xA;&#xA;&#xA;def init():&#xA;    point.set_data([], [])&#xA;    info_text.set_text("")&#xA;    return point, info_text&#xA;&#xA;&#xA;def update(frame):&#xA;    t = frame * dt  # time in hours&#xA;    theta = omega * t  # angle in radians&#xA;&#xA;    x = r * cos(theta) * scale&#xA;    y = r * sin(theta) * scale&#xA;&#xA;    point.set_data([x], [y])&#xA;    info_text.set_text(&#xA;        f"Time: {t:.2f} hr\nRadius: {r:.1f} km\nSpeed: {speed:.2f} km/h"&#xA;    )&#xA;    return point, info_text&#xA;&#xA;&#xA;&#xA;# Create animation&#xA;anim = FuncAnimation(&#xA;    fig, update, frames=frames, init_func=init, blit=True, interval=1000 / fps&#xA;)&#xA;&#xA;&#xA;with tqdm(total=frames, desc="Saving", unit="frame") as pbar:&#xA;    anim.save(filename, fps=fps, progress_callback=lambda i, n: pbar.update(1))&#xA;&#xA;# Add sound using MoviePy&#xA;video = VideoFileClip(filename)&#xA;video.audio = CompositeAudioClip([AudioFileClip("sound.wav")])&#xA;video.write_videofile(filename)&#xA;&#xA;startfile(filename)&#xA;

    &#xA;

    Could you figure out what the culprit is and how to fix it ?

    &#xA;

    enter image description here

    &#xA;

    Edit

    &#xA;

    Based on the given comment, I did the following but the problem still exists.

    &#xA;

    # Add sound using MoviePy&#xA;video = VideoFileClip(filename)&#xA;audio = AudioFileClip("sound.wav")&#xA;audio.duration = video.duration&#xA;video.audio = CompositeAudioClip([audio])&#xA;video.write_videofile(filename)&#xA;

    &#xA;