Recherche avancée

Médias (16)

Mot : - Tags -/mp3

Sur d’autres sites (335)

  • ffmgep stucks while merging two streams at input 0 [closed]

    3 février, par Robi Tagore

    I tried to merge two streams downloaded before, I was using ffmpeg to combine them. I could use the path directly, but I felt it would'nt always be, so I read the steams, after I combine them,
everytime I run the code it std errs the following output, and creates merged.mp4 with 0 bytes, help me find the mistake

    


    code

    


    
const {spawn} = require("child_process");
const fs = require("fs")


var audio = fs.createReadStream("audio.aac")
var video = fs.createReadStream("video.mp4")



var ffprocess = spawn("ffmpeg",[
    '-y',
    '-i', 'pipe:0', 
    '-i', 'pipe:1',  
    '-c', 'copy',  
    '-f', 'mp4',    
    'pipe:2',   
])

video.pipe(ffprocess.stdin)
audio.pipe(ffprocess.stdin)


ffprocess.stdout.on("data")


ffprocess.stderr.on("data", (data) => {
    console.log(`ffmpeg stderr ${data}`);
});
  
ffprocess.on("close", (code) => {
if (code === 0) {
    console.log("FFmpeg process exited successfully");
} else {
    console.error(`FFmpeg process exited with code ${code}`);
}
});


    


    output,

    


    ffmpeg stderr ffmpeg version 6.0-6ubuntu1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.2.0-2ubuntu1)
  configuration: --prefix=/usr --extra-version=6ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libvpl --disable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      58.  2.100 / 58.  2.100

ffmpeg stderr   libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100

ffmpeg stderr Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2023-07-31T07:06:25.000000Z
  Duration: 00:00:34.64, start: 0.000000, bitrate: N/A

ffmpeg stderr   Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 640x360 [SAR 1:1 DAR 16:9], 334 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      creation_time   : 2023-07-31T07:06:25.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 07/31/2023.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2023-07-31T07:06:25.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 07/31/2023.
      vendor_id       : [0][0][0][0]



    


    audio.aac video.mp4 sits in the same directory

    


    I have trying changing the -c flag and the other ones, but it somehow stucks and program dosent end up

    


    I have trying changing the -c flag and the other ones, but it somehow stucks and program dosent end up

    


  • The YouTube live stream encountered a failure

    12 février, par kuldeep chopra

    We are currently utilizing the ffmpeg library for streaming on YouTube Live. However, we have faced issues in a recent live streaming session that initially functioned correctly but encountered errors around the 13 to 15-minute mark. The error logs from FFmpeg during this session are as follows :

    


    Live Stream 1 Error :(Attempt 1)

    


    


    ffmpeg [flv @ 0x555c4bdfe680] Failed to update header with correct
duration. 2023-09-07T23:06:38.490+05:30 [flv @ 0x555c4bdfe680] Failed
to update header with correct filesize. 2023-09-07T23:06:38.491+05:30
failed => rtmp ://a.rtmp.youtube.com/live2/key......
2023-09-07T23:06:38.491+05:30
ffmpeg [tee @ 0x555c48843700] Slave
muxer #1 failed : Broken pipe, continuing with 1/2 slaves.

    


    


    Live Stream 2 Error (Attempt 2) :

    


    


    Slave muxer #1 failed : Connection reset by peer, continuing with 1/2
slaves.

    


    


    It is crucial to note that we have conducted numerous live streams on YouTube without encountering this error previously ; this is the first instance of such an issue.

    


    We kindly request your assistance in investigating and providing insights into the underlying problem causing these error messages. Any guidance or support you can offer in resolving this issue would be greatly appreciated.

    


  • ffmpeg is failing to load shared libraries after a ./configure with a prefix inside a conda environment

    30 janvier, par user3133806

    I am using conda and building ffmpeg from source within that environment.

    


    I ran the following commands :

    


    conda create --name my_conda_env
conda activate my_conda_env
# Now I am in the conda environment
# $CONDA_PREFIX is /home/myuser/.conda/envs/my_conda_env/bin/ffmpeg

# Checkout ffmpeg code
# git checkout ...

./configure --prefix=$CONDA_PREFIX --enable-shared --disable-static && make distclean && make -j 100 && make install

# The above command does install the newly built ffmpeg into:
# /home/myuser/.conda/envs/my_conda_env/bin/ffmpeg

# However it fails to execute:
ffmpeg
ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file: No such file or directory

# When I add the conda lib path to LD_LIBRARY_PATH it works:
LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH ffmpeg
ffmpeg version n4.2.9-4-gd7beb0c61f Copyright (c) 2000-2023 the FFmpeg developers

# I thought ./configure with a --prefix will build a binary that will search for libraries relative to itself, but that does not appear to be the case:

strace -o /tmp/strace.out ffmpeg
tail /tmp/strace.out

openat(AT_FDCWD, "/usr/lib64/haswell/x86_64/libavdevice.so.58", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib64/haswell/x86_64", 0x7fff65f56d90, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/haswell/libavdevice.so.58", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib64/haswell", 0x7fff65f56d90, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/avx512_1/x86_64/libavdevice.so.58", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib64/avx512_1/x86_64", 0x7fff65f56d90, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/avx512_1/libavdevice.so.58", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib64/avx512_1", 0x7fff65f56d90, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/x86_64/libavdevice.so.58", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib64/x86_64", 0x7fff65f56d90, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/libavdevice.so.58", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib64", {st_mode=S_IFDIR|0555, st_size=49526, ...}, 0) = 0
writev(2, [{iov_base="ffmpeg", iov_len=6}, {iov_base=": ", iov_len=2}, {iov_base="error while loading shared libra"..., iov_len=36}, {i
ov_base=": ", iov_len=2}, {iov_base="libavdevice.so.58", iov_len=17}, {iov_base=": ", iov_len=2}, {iov_base="cannot open shared object file", iov_len=30}, {iov_base=": ", iov_len=2}, {iov_base="No such file or directory", iov_len=25}, {iov_base="\n", iov_len=1}], 10) = 
123


    


    Conda documentation says not to use LD_LIBRARY_PATH here :

    


    https://docs.conda.io/projects/conda-build/en/stable/resources/use-shared-libraries.html#shared-libraries-in-macos-and-linux

    


    How can I build ffmpeg from source in a conda environment and have the binary find the .so file relative to itself ?