Recherche avancée

Médias (0)

Mot : - Tags -/interaction

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

Autres articles (32)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (2555)

  • Error Opening RTMP Stream through FFmpeg command when executed through exec package [closed]

    3 octobre 2024, par Akhil

    I have been trying to transcode the live stream from RTMP server running on rtmp://localhost:1936/live/test with FFmpeg in a Go application using os/exec package, But seems to not work and gives the input/output error (I have attached below). The same exact ffmpeg command when I execute on terminal, works as its supposed to. Not Sure why that is, here is my code for reproducing and analyzing the mistakes.

    


    ffmpegCmd := fmt.Sprintf("ffmpeg -nostdin -i rtmp://localhost:1936/live/%s -c:v libx264 -s %s -f %s %s/stream.mpd",
        streamKey, resolution, sp.OutputFormat, outputPath)
    log.Printf("Executing FFmpeg command: %s", ffmpegCmd)

    // Prepare the command execution with a timeout context
    ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) // Set a 60-second timeout
    defer cancel()

    cmd := exec.CommandContext(ctx, "bash", "-c", ffmpegCmd)


    


    the ffmpeg command looks like this :
    
ffmpeg -nostdin -i rtmp://localhost:1936/live/test -c:v libx264 -s 1920x1080 -f dash output/test/1080p/stream.mpd

    


    I get the following error :

    


    Error opening input: Input/output error

Error opening input file rtmp://localhost:1936/live/test.

Error opening input files: Input/output error

Exiting normally, received signal 2.

signal: interrupt


    


    I have already tried to break the command, and then execute it. Something like :

    


    cmd := exec.CommandContext(ctx,
        "ffmpeg",
        "-nostdin",
        "-i", "rtmp://localhost:1936/live/"+streamKey,
        "-c:v", "libx264",
        "-s", resolution,
        "-f", sp.OutputFormat,
        outputPath+"/stream.mpd")


    


    After running the ffmpeg command with -loglevel debug and -report :

    


    Here is the logs and errors I get :

    


    When I run it within the go application :

    


    ffmpeg started on 2024-10-02 at 12:00:06
Report written to "ffmpeg-20241002-120006.log"
Log level: 48
Command line:
ffmpeg -loglevel debug -report -i rtmp://localhost:1936/live/test -c:v libx264 -s 1920x1080 -f dash ./output/test/1080p/stream.mpd
ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.3.9.4)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0.2_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --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 --enable-neon
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-i' ... matched as input url with argument 'rtmp://localhost:1936/live/test'.
Reading option '-c:v' ... matched as option 'c' (select encoder/decoder ('copy' to copy stream without reencoding)) with argument 'libx264'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or abbreviation)) with argument '1920x1080'.
Reading option '-f' ... matched as option 'f' (force container format (auto-detected otherwise)) with argument 'dash'.
Reading option './output/test/1080p/stream.mpd' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url rtmp://localhost:1936/live/test.
Successfully parsed a group of options.
Opening an input file: rtmp://localhost:1936/live/test.
[AVFormatContext @ 0x13f721f90] Opening 'rtmp://localhost:1936/live/test' for reading
[rtmp @ 0x13f6040e0] No default whitelist set
[tcp @ 0x13f7223d0] No default whitelist set
[tcp @ 0x13f7223d0] Original list of addresses:
[tcp @ 0x13f7223d0] Address ::1 port 1936
[tcp @ 0x13f7223d0] Address 127.0.0.1 port 1936
[tcp @ 0x13f7223d0] Interleaved list of addresses:
[tcp @ 0x13f7223d0] Address ::1 port 1936
[tcp @ 0x13f7223d0] Address 127.0.0.1 port 1936
[tcp @ 0x13f7223d0] Starting connection attempt to ::1 port 1936
[tcp @ 0x13f7223d0] Connection attempt to ::1 port 1936 failed: Connection refused
[tcp @ 0x13f7223d0] Starting connection attempt to 127.0.0.1 port 1936
[tcp @ 0x13f7223d0] Successfully connected to 127.0.0.1 port 1936
[rtmp @ 0x13f6040e0] Handshaking...
[rtmp @ 0x13f6040e0] Type answer 3
[rtmp @ 0x13f6040e0] Server version 13.14.10.13
[rtmp @ 0x13f6040e0] Proto = rtmp, path = /live/test, app = live, fname = test
[rtmp @ 0x13f6040e0] Window acknowledgement size = 5000000
[rtmp @ 0x13f6040e0] Max sent, unacked = 5000000
[rtmp @ 0x13f6040e0] New incoming chunk size = 4096
[rtmp @ 0x13f6040e0] Creating stream...
[rtmp @ 0x13f6040e0] Sending play command for 'test'
[rtmp @ 0x13f6040e0] Deleting stream...
[in#0 @ 0x13f721d40] Error opening input: Input/output error
Error opening input file rtmp://localhost:1936/live/test.
Error opening input files: Input/output error
Exiting normally, received signal 2.


    


    This is what i get when i run the same command on terminal :

    


    <same as="as" but="but" please="please" scroll="scroll" further="further">&#xA;&#xA;[rtmp @ 0x1437144c0] No default whitelist set&#xA;[tcp @ 0x143604f20] No default whitelist set&#xA;[tcp @ 0x143604f20] Original list of addresses:&#xA;[tcp @ 0x143604f20] Address ::1 port 1936&#xA;[tcp @ 0x143604f20] Address 127.0.0.1 port 1936&#xA;[tcp @ 0x143604f20] Interleaved list of addresses:&#xA;[tcp @ 0x143604f20] Address ::1 port 1936&#xA;[tcp @ 0x143604f20] Address 127.0.0.1 port 1936&#xA;[tcp @ 0x143604f20] Starting connection attempt to ::1 port 1936&#xA;[tcp @ 0x143604f20] Connection attempt to ::1 port 1936 failed: Connection refused&#xA;[tcp @ 0x143604f20] Starting connection attempt to 127.0.0.1 port 1936&#xA;[tcp @ 0x143604f20] Successfully connected to 127.0.0.1 port 1936&#xA;[rtmp @ 0x1437144c0] Handshaking...&#xA;[rtmp @ 0x1437144c0] Type answer 3&#xA;[rtmp @ 0x1437144c0] Server version 13.14.10.13&#xA;[rtmp @ 0x1437144c0] Proto = rtmp, path = /live/test, app = live, fname = test&#xA;[rtmp @ 0x1437144c0] Window acknowledgement size = 5000000&#xA;[rtmp @ 0x1437144c0] Max sent, unacked = 5000000&#xA;[rtmp @ 0x1437144c0] New incoming chunk size = 4096&#xA;[rtmp @ 0x1437144c0] Creating stream...&#xA;[rtmp @ 0x1437144c0] Sending play command for &#x27;test&#x27;&#xA;[flv @ 0x143604b30] Format flv probed with size=2048 and score=100&#xA;[flv @ 0x143604b30] Before avformat_find_stream_info() pos: 13 bytes read:2263 seeks:0 nb_streams:0&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: mdct_float, len: 64, factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft32_ns_float_neon - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: mdct_float, len: 64, factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft32_ns_float_neon - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_pfa_15xM_inv_float_c - type: mdct_float, len: 120, factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft4_fwd_float_neon - type: fft_float, len: 4, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: mdct_float, len: 128, factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft_sr_ns_float_neon - type: fft_float, len: 64, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_pfa_15xM_inv_float_c - type: mdct_float, len: 480, factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft16_ns_float_neon - type: fft_float, len: 16, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: mdct_float, len: 512, factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft_sr_ns_float_neon - type: fft_float, len: 256, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_pfa_15xM_inv_float_c - type: mdct_float, len: 960, factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft32_ns_float_neon - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: mdct_float, len: 1024, factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft_sr_ns_float_neon - type: fft_float, len: 512, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_fwd_float_c - type: mdct_float, len: 1024, factors[2]: [2, any], flags: [unaligned, out_of_place, fwd_only]&#xA;        fft_sr_ns_float_neon - type: fft_float, len: 512, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;[NULL @ 0x144124920] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[NULL @ 0x144124920] Decoding VUI&#xA;[NULL @ 0x144124920] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[NULL @ 0x144124920] Decoding VUI&#xA;[h264 @ 0x144124920] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x144124920] Decoding VUI&#xA;[h264 @ 0x144124920] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[h264 @ 0x144124920] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x144124920] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[h264 @ 0x144124920] nal_unit_type: 5(IDR), nal_ref_idc: 3&#xA;[h264 @ 0x144124920] Decoding VUI&#xA;[h264 @ 0x144124920] Format yuv420p chosen by get_format().&#xA;[h264 @ 0x144124920] Reinit context to 1280x720, pix_fmt: yuv420p&#xA;[h264 @ 0x144124920] no picture &#xA;[flv @ 0x143604b30] All info found&#xA;[flv @ 0x143604b30] rfps: 29.666667 0.016552&#xA;[flv @ 0x143604b30] rfps: 29.750000 0.009347&#xA;[flv @ 0x143604b30] rfps: 29.750000 0.009347&#xA;[flv @ 0x143604b30] rfps: 29.833333 0.004197&#xA;[flv @ 0x143604b30] rfps: 29.916667 0.001104&#xA;[flv @ 0x143604b30] rfps: 29.916667 0.001104&#xA;[flv @ 0x143604b30] rfps: 30.000000 0.000067&#xA;[flv @ 0x143604b30] rfps: 30.000000 0.000067&#xA;[flv @ 0x143604b30] rfps: 60.000000 0.000270&#xA;[flv @ 0x143604b30] rfps: 60.000000 0.000270&#xA;[flv @ 0x143604b30] rfps: 120.000000 0.001079&#xA;[flv @ 0x143604b30] rfps: 120.000000 0.001079&#xA;[flv @ 0x143604b30] rfps: 240.000000 0.004316&#xA;[flv @ 0x143604b30] rfps: 240.000000 0.004316&#xA;[flv @ 0x143604b30] rfps: 29.970030 0.000204&#xA;[flv @ 0x143604b30] rfps: 29.970030 0.000204&#xA;[flv @ 0x143604b30] rfps: 59.940060 0.000814&#xA;[flv @ 0x143604b30] rfps: 59.940060 0.000814&#xA;[flv @ 0x143604b30] After avformat_find_stream_info() pos: 496783 bytes read:496783 seeks:0 frames:179&#xA;Input #0, flv, from &#x27;rtmp://localhost:1936/live/test&#x27;:&#xA;  Metadata:&#xA;    |RtmpSampleAccess: true&#xA;    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)&#xA;    displayWidth    : 1280&#xA;    displayHeight   : 720&#xA;    fps             : 30&#xA;    profile         : &#xA;    level           : &#xA;  Duration: 00:00:00.00, start: 6.742000, bitrate: N/A&#xA;  Stream #0:0, 138, 1/1000: Audio: aac (LC), 48000 Hz, stereo, fltp, 163 kb/s&#xA;  Stream #0:1, 41, 1/1000: Video: h264 (High), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 0/1, 2560 kb/s, 30 fps, 30 tbr, 1k tbn&#xA;Successfully opened the file.&#xA;Parsing a group of options: output url ./output/test/1080p/stream.mpd.&#xA;Applying option c:v (select encoder/decoder (&#x27;copy&#x27; to copy stream without reencoding)) with argument libx264.&#xA;Applying option s (set frame size (WxH or abbreviation)) with argument 1920x1080.&#xA;Applying option f (force container format (auto-detected otherwise)) with argument dash.&#xA;Successfully parsed a group of options.&#xA;Opening an output file: ./output/test/1080p/stream.mpd.&#xA;[out#0/dash @ 0x123707480] No explicit maps, mapping streams automatically...&#xA;[vost#0:0/libx264 @ 0x123707d60] Created video stream from input stream 0:1&#xA;detected 10 logical cores&#xA;[h264 @ 0x123607b70] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x123607b70] Decoding VUI&#xA;[h264 @ 0x123607b70] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[aost#0:1/aac @ 0x144028080] Created audio stream from input stream 0:0&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: md&#xA;&#xA;<it simply="simply" starts="starts" working="working">&#xA;</it></same>

    &#xA;

    I am not sure if there is something to do with Permissions.

    &#xA;

  • Stream sent via FFMPEG (NodeJS) to RTMP (YouTube) not being received

    10 décembre 2024, par Qumber

    I am writing a very basic chrome extension that captures and sends video stream to a nodeJS server, which in turns sends it to Youtube live server.

    &#xA;

    Here is my implementation of the backend which receives data via WebRTC and send to YT using FFMPEG :

    &#xA;

    const express = require(&#x27;express&#x27;);&#xA;const cors = require(&#x27;cors&#x27;);&#xA;const { RTCPeerConnection, RTCSessionDescription } = require(&#x27;@roamhq/wrtc&#x27;);&#xA;const { spawn } = require(&#x27;child_process&#x27;);&#xA;&#xA;const app = express();&#xA;app.use(express.json());&#xA;app.use(cors());&#xA;&#xA;app.post(&#x27;/webrtc&#x27;, async (req, res) => {&#xA;  const peerConnection = new RTCPeerConnection();&#xA;&#xA;  // Start ffmpeg process for streaming&#xA;  const ffmpeg = spawn(&#x27;ffmpeg&#x27;, [&#xA;    &#x27;-f&#x27;, &#x27;flv&#x27;,&#xA;    &#x27;-i&#x27;, &#x27;pipe:0&#x27;,&#xA;    &#x27;-c:v&#x27;, &#x27;libx264&#x27;,&#xA;    &#x27;-preset&#x27;, &#x27;veryfast&#x27;,&#xA;    &#x27;-maxrate&#x27;, &#x27;3000k&#x27;,&#xA;    &#x27;-bufsize&#x27;, &#x27;6000k&#x27;,&#xA;    &#x27;-pix_fmt&#x27;, &#x27;yuv420p&#x27;,&#xA;    &#x27;-g&#x27;, &#x27;50&#x27;,&#xA;    &#x27;-f&#x27;, &#x27;flv&#x27;,&#xA;    &#x27;rtmp://a.rtmp.youtube.com/live2/MY_KEY&#x27;&#xA;  ]);&#xA;&#xA;  ffmpeg.on(&#x27;error&#x27;, (err) => {&#xA;    console.error(&#x27;FFmpeg error:&#x27;, err);&#xA;  });&#xA;&#xA;  ffmpeg.stderr.on(&#x27;data&#x27;, (data) => {&#xA;    console.error(&#x27;FFmpeg stderr:&#x27;, data.toString());&#xA;  });&#xA;&#xA;  ffmpeg.stdout.on(&#x27;data&#x27;, (data) => {&#xA;    console.log(&#x27;FFmpeg stdout:&#x27;, data.toString());&#xA;  });&#xA;&#xA;  // Handle incoming tracks&#xA;  peerConnection.ontrack = (event) => {&#xA;    console.log(&#x27;Track received:&#x27;, event.track.kind);&#xA;    const track = event.track;&#xA;&#xA;    // Stream the incoming track to FFmpeg&#xA;    track.onunmute = () => {&#xA;      console.log(&#x27;Track unmuted:&#x27;, track.kind);&#xA;      const reader = track.createReadStream();&#xA;      reader.on(&#x27;data&#x27;, (chunk) => {&#xA;        console.log(&#x27;Forwarding chunk to FFmpeg:&#x27;, chunk.length);&#xA;        ffmpeg.stdin.write(chunk);&#xA;      });&#xA;      reader.on(&#x27;end&#x27;, () => {&#xA;        console.log(&#x27;Stream ended&#x27;);&#xA;        ffmpeg.stdin.end();&#xA;      });&#xA;    };&#xA;&#xA;    track.onmute = () => {&#xA;      console.log(&#x27;Track muted:&#x27;, track.kind);&#xA;    };&#xA;  };&#xA;&#xA;  // Set the remote description (offer) received from the client&#xA;  await peerConnection.setRemoteDescription(new RTCSessionDescription(req.body.sdp));&#xA;&#xA;  // Create an answer and send it back to the client&#xA;  const answer = await peerConnection.createAnswer();&#xA;  await peerConnection.setLocalDescription(answer);&#xA;&#xA;  res.json({ sdp: peerConnection.localDescription });&#xA;});&#xA;&#xA;app.listen(3000, () => {&#xA;  console.log(&#x27;WebRTC to RTMP server running on port 3000&#x27;);&#xA;});&#xA;&#xA;

    &#xA;

    This is the output I get, but nothing gets sent to YouTube :

    &#xA;

    &#xA;
    FFmpeg stderr: ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers&#xA;  built with Apple clang version 15.0.0 (clang-1500.3.9.4)&#xA;&#xA;FFmpeg stderr:   configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0.2_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags=&#x27;-Wl,-ld_classic&#x27; --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --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 --enable-neon&#xA;&#xA;FFmpeg stderr:   libavutil      59.  8.100 / 59.  8.100&#xA;  libavcodec     61.  3.100 / 61.  3.100&#xA;  libavformat    61.  1.100 / 61.  1.100&#xA;  libavdevice    61.  1.100 / 61.  1.100&#xA;&#xA;FFmpeg stderr:   libavfilter    10.  1.100 / 10.  1.100&#xA;  libswscale      8.  1.100 /  8.  1.100&#xA;  libswresample   5.  1.100 /  5.  1.100&#xA;  libpostproc    58.  1.100 / 58.  1.100&#xA;

    &#xA;

    &#xA;

    I do not understand what I am doing wrong. Any help would be appreciated.

    &#xA;


    &#xA;

    Optionally Here's the frontend code from the extension, which (to me) appears to be recording and sending the capture :

    &#xA;

    popup.js & popup.html

    &#xA;

    &#xD;&#xA;
    &#xD;&#xA;
    document.addEventListener(&#x27;DOMContentLoaded&#x27;, () => {&#xA;  document.getElementById(&#x27;openCapturePage&#x27;).addEventListener(&#x27;click&#x27;, () => {&#xA;    chrome.tabs.create({&#xA;      url: chrome.runtime.getURL(&#x27;capture.html&#x27;)&#xA;    });&#xA;  });&#xA;});

    &#xD;&#xA;

    &#xA;&#xA;&#xA;&#xA;  &#xA;  <code class="echappe-js">&lt;script src='http://stackoverflow.com/feeds/tag/popup.js'&gt;&lt;/script&gt;&#xA;&#xA;&#xA;&#xA;  

    StreamSavvy

    &#xA;

    &#xA;&#xA;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

    capture.js & capture.html

    &#xA;

    &#xD;&#xA;
    &#xD;&#xA;
    let peerConnection;&#xA;&#xA;async function startStreaming() {&#xA;  try {&#xA;    const stream = await navigator.mediaDevices.getDisplayMedia({&#xA;      video: {&#xA;        cursor: "always"&#xA;      },&#xA;      audio: false&#xA;    });&#xA;&#xA;    peerConnection = new RTCPeerConnection({&#xA;      iceServers: [{&#xA;        urls: &#x27;stun:stun.l.google.com:19302&#x27;&#xA;      }]&#xA;    });&#xA;&#xA;    stream.getTracks().forEach(track => peerConnection.addTrack(track, stream));&#xA;&#xA;    const offer = await peerConnection.createOffer();&#xA;    await peerConnection.setLocalDescription(offer);&#xA;&#xA;    const response = await fetch(&#x27;http://localhost:3000/webrtc&#x27;, {&#xA;      method: &#x27;POST&#x27;,&#xA;      headers: {&#xA;        &#x27;Content-Type&#x27;: &#x27;application/json&#x27;&#xA;      },&#xA;      body: JSON.stringify({&#xA;        sdp: peerConnection.localDescription&#xA;      })&#xA;    });&#xA;&#xA;    const {&#xA;      sdp&#xA;    } = await response.json();&#xA;    await peerConnection.setRemoteDescription(new RTCSessionDescription(sdp));&#xA;&#xA;    console.log("Streaming to server via WebRTC...");&#xA;  } catch (error) {&#xA;    console.error("Error starting streaming:", error.name, error.message);&#xA;  }&#xA;}&#xA;&#xA;async function stopStreaming() {&#xA;  if (peerConnection) {&#xA;    // Stop all media tracks&#xA;    peerConnection.getSenders().forEach(sender => {&#xA;      if (sender.track) {&#xA;        sender.track.stop();&#xA;      }&#xA;    });&#xA;&#xA;    // Close the peer connection&#xA;    peerConnection.close();&#xA;    peerConnection = null;&#xA;    console.log("Streaming stopped");&#xA;  }&#xA;}&#xA;&#xA;document.addEventListener(&#x27;DOMContentLoaded&#x27;, () => {&#xA;  document.getElementById(&#x27;startCapture&#x27;).addEventListener(&#x27;click&#x27;, startStreaming);&#xA;  document.getElementById(&#x27;stopCapture&#x27;).addEventListener(&#x27;click&#x27;, stopStreaming);&#xA;});

    &#xD;&#xA;

    &#xA;&#xA;&#xA;&#xA;  &#xA;  <code class="echappe-js">&lt;script src='http://stackoverflow.com/feeds/tag/capture.js'&gt;&lt;/script&gt;&#xA;&#xA;&#xA;&#xA;  

    StreamSavvy Capture

    &#xA;

    &#xA;

    &#xA;&#xA;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

    background.js (service worker)

    &#xA;

    &#xD;&#xA;
    &#xD;&#xA;
    chrome.runtime.onInstalled.addListener(() => {&#xA;  console.log("StreamSavvy Extension Installed");&#xA;});&#xA;&#xA;chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {&#xA;  if (message.type === &#x27;startStreaming&#x27;) {&#xA;    chrome.tabs.create({&#xA;      url: chrome.runtime.getURL(&#x27;capture.html&#x27;)&#xA;    });&#xA;    sendResponse({&#xA;      status: &#x27;streaming&#x27;&#xA;    });&#xA;  } else if (message.type === &#x27;stopStreaming&#x27;) {&#xA;    chrome.tabs.query({&#xA;      url: chrome.runtime.getURL(&#x27;capture.html&#x27;)&#xA;    }, (tabs) => {&#xA;      if (tabs.length > 0) {&#xA;        chrome.tabs.sendMessage(tabs[0].id, {&#xA;          type: &#x27;stopStreaming&#x27;&#xA;        });&#xA;        sendResponse({&#xA;          status: &#x27;stopped&#x27;&#xA;        });&#xA;      }&#xA;    });&#xA;  }&#xA;  return true; // Keep the message channel open for sendResponse&#xA;});

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

  • ffmpeg change audio encoding and combine audio files

    7 septembre 2024, par Simon

    I asked a question about combining linear16 encoded audio files together here - Combine linear16 encoded audio files | PHP

    &#xA;

    I was suggested to use ffmpeg, I'm new with it, any suggestion how to combine LINEAR16 encoded audio files ?

    &#xA;

    ...&#xA;$client = new TextToSpeechClient();&#xA;$synthesisInputText = new SynthesisInput();&#xA;$audioConfig = new AudioConfig();&#xA;// $audioConfig->setAudioEncoding(AudioEncoding::MP3); works fine&#xA;$audioConfig->setAudioEncoding(AudioEncoding::LINEAR16);&#xA;$voice = new VoiceSelectionParams();&#xA;&#xA;$voice->setLanguageCode(&#x27;en-US&#x27;);&#xA;$voice->setName(&#x27;en-US-Neural2-A&#x27;);&#xA;&#xA;$media_total = &#x27;&#x27;;&#xA;foreach($txt_array as $k => $txt) {&#xA;&#xA;     $synthesisInputText->setText($txt);&#xA;     $response = $client->synthesizeSpeech($synthesisInputText, $voice, $audioConfig);&#xA;     $media = $response->getAudioContent();&#xA;&#xA;     $media_total .= $media; // audio is encoded linear16, and combining in this way does not work&#xA;    &#xA;// how to use ffmpeg here, to combine $media pieces, change encoding&#xA;&#xA;}&#xA;

    &#xA;

    Thanks

    &#xA;

    UPDATE

    &#xA;

    Examples of generated audio files, stored in mp3 file :&#xA;https://storage.googleapis.com/gspeech-audio-storage/gspeech_en-US:6:D:1:0_5c021edd23218122a7ce116cb297bc91_5be04f8b55b1b28025ad6eea55109e83.mp3

    &#xA;

    The audio looks like this. Seems like when making encoding as linear16, the output like the WAV format :

    &#xA;

    5249 4646 240b 0400 5741 5645 666d 7420&#xA;1000 0000 0100 0100 c05d 0000 80bb 0000&#xA;0200 1000 6461 7461 000b 0400 ffff f2ff&#xA;d6ff bcff b7ff c9ff f5ff 2900 5800 7b00&#xA;8800 8b00 8c00 8d00 9000 9400 9100 8800&#xA;7a00 6600 5400 4500 3e00 3b00 3600 3200&#xA;2800 1b00 1000 0a00 0700 0200 f8ff f5ff&#xA;f3ff f8ff ffff 0400 0300 0e00 1b00 0c00&#xA;0800 0500 1000 1500 1e00 2800 2b00 2e00&#xA;2b00 2d00 2900 3000 3300 3200 2f00 2600&#xA;1800 0b00 0200 feff f6ff f7ff f5ff f3ff&#xA;f1ff edff eaff e6ff e1ff d5ff d0ff caff&#xA;c5ff c3ff c2ff c1ff cbff ccff cbff d0ff&#xA;d9ff d7ff ddff ddff e0ff e5ff e2ff f2ff&#xA;f4ff fdff 0200 0100 0600 0a00 1000 0e00&#xA;1300 0f00 0f00 1c00 1a00 2000 2400 2500&#xA;2500 2000 1d00 1800 1300 0f00 1200 0500&#xA;fdff f1ff ecff ddff d3ff cdff b7ff c1ff&#xA;c0ff b8ff b4ff b2ff aaff a8ff a5ff abff&#xA;a6ff a0ff 9bff 91ff 8fff 8aff 86ff 83ff&#xA;84ff 8aff 83ff 78ff 70ff 65ff 66ff 6eff&#xA;71ff 70ff 6fff 69ff 5aff 54ff 4fff 5bff&#xA;5eff 64ff 6eff 68ff 68ff 6aff 6aff 65ff&#xA;71ff 63ff 5aff 54ff 4aff 4eff 56ff 58ff&#xA;66ff 6bff 66ff 66ff 70ff 75ff 6bff 7bff&#xA;71ff 76ff 8bff 98ff 8eff 95ff 9fff 92ff&#xA;93ff 98ff a2ff afff bdff baff b5ff bdff&#xA;b6ff c1ff c0ff c9ff d9ff dfff e7ff f5ff&#xA;f8ff ffff 1000 1200 1200 0a00 0a00 1100&#xA;f7ff 0900 0a00 0300 1300 0e00 1300 1900&#xA;1e00 2600 0400 1700 2000 2600 3200 2f00&#xA;2b00 1c00 2500 1d00 2800 2f00 3200 3d00&#xA;2b00 3c00 3100 4300 4900 4300 5c00 6c00&#xA;6a00 5f00 5e00 4d00 4400 4800 4900 2e00&#xA;3300 3500 3900 3e00 4800 3a00 3600 3a00&#xA;3700 3900 2d00 3800 3800 2700 2500 2000&#xA;2c00 2800 2700 3100 0f00 2100 4200 2f00&#xA;2e00 2400 2c00 2600 1900 2a00 0100 1600&#xA;1d00 2900 4100 4100 6400 5c00 5700 4800&#xA;3e00 3800 1f00 2700 3600 2400 3d00 5200&#xA;6600 6400 6200 4600 4f00 4800 2200 2000&#xA;1f00 2800 0400 2300 1700 2b00 2700 1800&#xA;0000 0000 f0ff e3ff b9ff a6ff acff a3ff&#xA;a2ff 97ff a5ff 96ff 7aff 5cff 56ff 4eff&#xA;31ff 18ff 2aff 1eff 11ff 19ff 04ff 07ff&#xA;08ff e3fe f3fe 1eff e8fe f5fe f1fe cffe&#xA;03ff e2fe 17ff 2bff 11ff 34ff 4fff 4fff&#xA;2dff 4bff 43ff 2eff 60ff 49ff 6cff acff&#xA;e9ff 0b00 5600 3e00 5000 3d00 5b00 5500&#xA;4300 2100 3500 2d00 6200 6800 4b00 5900&#xA;9a00 3a00 5d00 6e00 3200 0400 1400 f8ff&#xA;2900 3200 0700 ebff 0700 f2ff 2800 1100&#xA;1c00 3700 d7ff ddff cdff e3ff f2ff 0e00&#xA;daff 2f00 6900 8f00 a900 7900 6e00 6b00&#xA;f000 e500 7e00 ab00 de00 c700 e000 4801&#xA;3b01 5c01 1901 0701 6c01 e300 f800 4a01&#xA;2901 5a01 5f01 6701 8801 5901 1701 1e01&#xA;4901 3f01 1f01 ff00 5601 cf00 5200 0401&#xA;2e01 7001 2801 4d01 a100 df00 df00 6801&#xA;6401 a100 fa00 ba01 e300 b000 2c01 5501&#xA;b3ff 7e01 5702 3700 f300 6401 f501 3f02&#xA;9dff 98ff 8201 2cff 24fd 6b01 6bff 48ff&#xA;7301 f201 9102 a0ff 3c02 9c00 c500 3901&#xA;5d02 a500 1200 1300 bdfe d8fe 25ff 10fe&#xA;04fd a400 0300 ad01 9e04 6105 1405 ee04&#xA;fe04 8a05 4606 2f05 5702 fa02 1901 b002&#xA;4cff 8b01 9902 6a03 0d04 2e05 f202 3801&#xA;9000 d4fe 0c00 2501 56ff 41ff 31ff 98fd&#xA;d0fd a7fb 3efe 45ff 91fc c9fe 3cfd 21fc&#xA;b5fd 2bfd 7bfb 0afd 14ff f1fe 95ff 18ff&#xA;0000 50fd 59fe a000 f9ff 7a00 8100 1100&#xA;f0ff 5300 af00 1f00 3a03 e001 7703 2e03&#xA;9503 5001 8fff b400 c9ff 1602 d201 3e00&#xA;2201 9501 88ff 71ff f901 5100 4eff 1b00&#xA;7e00 aefe e6fd 24fd 27fc d2fe 47fd d5fe&#xA;befe ddfd 22ff 03fe c7fc 5dfe c2fd f2fb&#xA;aefe 45fd 63fd 16fb 82fd ecfc 5ffc 66fd&#xA;3cfe fcfd 4cfd 21fe f2fd 3bfd 0afd f8fc&#xA;74fd bafe 36fd 6bff 65fe c2fd c0fd e8fe&#xA;cbff 1dff dcff 26ff 3afe 92fd 06fd 49fe&#xA;78fb 30fe 8bff dafe bcff 37ff 50fe a3fe&#xA;69fe 7dfe 5e00 06ff 1900 4afd 93fd 09ff&#xA;0eff d5fd a900 d702 0300 a301 2903 2fff&#xA;07ff d6fd 51fe 9aff 8dff 3200 4a01 e200&#xA;cdff 5201 d501 fd01 bd00 6001 ab00 c6fd&#xA;20ff ccff c0fc 6eff c400 44ff 8001 24ff&#xA;3bff 0800 93fd 9500 bffe 9dfe c8fe dafd&#xA;5ffe 76fe e6ff 8bfe 8500 6001 73ff a200&#xA;d2fe fdfe 1bff 60ff cb00 1800 1d01 7e00&#xA;f800 c600 ec00 9e01 c101 f601 8701 ff01&#xA;fb01 d400 bc00 b300 5c00 9100 eeff 6e01&#xA;6c02 3eff b0ff 1101 7bff d8ff 9c00 6ffe&#xA;1fff aafd a0fe d8fd b5fe 5cfd 36fc 31ff&#xA;24fe 71ff 23fe 60ff 65fd 20fd 5efd 9efb&#xA;7bfe 07fc 3ffc c1fe ecfc c1fb bcfb ebfc&#xA;6afd d1fd 9cff 8dfe 82fd cffd 4dfc 53fd&#xA;6cfd 82fe a1fd 52fd f8fe 6ffd 39fd e8fc&#xA;b7fb 23fd 2dfd aefc aefc bffc 75fc f0fa&#xA;f5fc e8fd 76fe 2dfd 9afc 80fd 1bfc a8fa&#xA;36fd 35fa d8f9 31fa d1fa f8fb a2fc e7fd&#xA;52fd d0fe d9ff 2eff 97ff 41ff 23fd 22fe&#xA;73fd 88fd 78ff 9aff e2fe 0802 e203 b203&#xA;0b04 6104 9303 1903 d701 4704 b905 0903&#xA;d103 5805 3006 0706 7707 4a07 9607 e907&#xA;d606 b906 1f08 ee04 1a04 1507 3d08 ff08&#xA;ce09 740a a609 5109 ff08 fd08 a708 e507&#xA;1e08 2e07 7208 4e08 9807 3009 6808 d408&#xA;c00a 250a f308 6807 4806 5c05 0904 2206&#xA;6e06 8707 c208 3c08 8e0a 7e09 fc07 7708&#xA;d406 d205 6405 6d04 7e04 6604 7704 7005&#xA;7707 2107 1a06 9b05 ab03 5901 47fe 75fd&#xA;28fc 84fa 87fb 21fc d4fb 77f9 41f9 98f8&#xA;57f7 2bf6 7af4 64f2 7cee 29ec 05ea 9ee8&#xA;90e9 0aea d2ea b6eb efeb 77e9 e0e6 85e6&#xA;59e4 5fe4 89e6 cee8 10ea 5eeb 5aee 66ef&#xA;49f2 4cf7 3ffa 91fb befd 75fd 8ffd 32fd&#xA;9eff 0202 8806 7a07 c90d ca15 b913 5614&#xA;7a16 7e16 a515 c617 2c17 c815 8b13 ef0f&#xA;9512 4f13 0212 5313 c413 0511 5810 cf0d&#xA;f907 8704 6b01 47fd 7afb 8bfb a9f8 25f8&#xA;0ef7 acf5 1cf5 83f3 fff2 53f0 c4ed 7ceb&#xA;76eb 14e9 eee8 f8e9 cfeb 1ded 89ef dff2&#xA;fcf3 caf4 bff4 0df6 b7f6 57f7 89f9 56fc&#xA;bafe 6702 c705 2609 ee0b 480e 5610 c512&#xA;9713 1614 9015 9d16 da16 e417 ad19 831a&#xA;cb1b 541d 421e 341e 5f1d 701b 1419 c117&#xA;e615 6b15 af15 b714 6e13 fe13 3112 1d11&#xA;be0f 130c 430a 4d08 9305 0d03 4402 9cff&#xA;4ffd 1efe 9dfd 73fc 8efa 49f9 76f7 e3f3&#xA;3bf1 19f0 fded ebeb daec edec c4eb bdea&#xA;ace9 b4e7 b7e5 73e4 f8e2 f3e1 d3e0 fadf&#xA;35df 77e0 c6e1 84e2 f3e2 14e2 04e1 03df&#xA;49dc 7bdc 61db a2dc dde4 99ed fef1 1bf9&#xA;93fc 76f9 11fa 3c01 df02 ce04 2c07 f106&#xA;8f09 9b07 470a 4d0f 5213 b817 6d20 5a23&#xA;...&#xA;

    &#xA;

    And when the encoding is set to mp3, it looks like this :

    &#xA;

    fff3 84c4 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;0000 0000 0000 0000 0000 0000 0000 0000&#xA;...&#xA;

    &#xA;

    It seems like the linear16 file, which can be repeated one after another, and it works fine.

    &#xA;

    I was trying to convert audio1 format to audio2 in native php by making a byte analyze, but the result was broken, and not be readable.

    &#xA;