Recherche avancée

Médias (1)

Mot : - Tags -/getid3

Sur d’autres sites (333)

  • ffmpeg - converting one audio track of a multi-track mp4

    30 décembre 2023, par Shaun.M

    I'm having a few mp4 with two audio tracks,
an english one in aac and a french one in dts.

    


    Now I want to convert only the french dts to eac3 with a single ffmpeg command.

    


    I use

    


    ffmpeg -hide_banner -i input.mp4 ^
             -map_metadata -1 ^
             -map 0:0 -c:v copy ^
             -map 0:1 -c:a copy ^
             -map 0:2 -c:a eac3 -b:a 1536k ^
             -metadata:s:a:0 language=eng ^
             -metadata:s:a:0 title="Stereo" ^
             -metadata:s:a:1 language=fra ^
             -metadata:s:a:1 title="Stereo" ^
output.mp4


    


    This works quite nice, but it converts both audio tracks to eac3, instead of leaving the first one untouched ...
What's wrong in the command ?

    


    (ffmpeg version 2023-12-23-git-f5f414d9c4-full_build-www.gyan.dev under Windows 10)

    


  • FFmpeg Could not write header for output file #0 (incorrect codec parameters ?) : Invalid data found when processing input [closed]

    29 décembre 2023, par randompersonhehe

    I'm having trouble using FFmpeg to host an RTSP server for continuous video streaming. The command I'm using is :

    


    


    ffmpeg -report -v verbose -re -stream_loop -1 -i store-aisle-detection.mp4 -c copy -f rtsp rtsp ://localhost:8888/mystream

    


    


    Log :

    


    ffmpeg started on 2023-12-29 at 15:35:47
Report written to "ffmpeg-20231229-153547.log"
Log level: 48
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --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 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[h264 @ 0x560863a19240] Reinit context to 720x416, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'store-aisle-detection.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2018-07-18T23:51:37.000000Z
  Duration: 00:01:05.49, start: 0.000000, bitrate: 1125 kb/s
  Stream #0:0(eng): Video: h264 (Main), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, smpte170m, left), 720x404 (720x416), 1089 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
      creation_time   : 2018-07-18T23:51:37.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 24000 Hz, mono, fltp, 30 kb/s (default)
    Metadata:
      creation_time   : 2018-07-18T23:51:37.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
      vendor_id       : [0][0][0][0]
[tcp @ 0x560863b71e80] Starting connection attempt to 127.0.0.1 port 8888
[tcp @ 0x560863b71e80] Successfully connected to 127.0.0.1 port 8888
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input
Error initializing output stream 0:1 -- 
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times
[AVIOContext @ 0x560863a20300] Statistics: 135494 bytes read, 0 seeks




    


    Can anyone help me identify and fix the problem with this command ? I want to loop the video infinitely on the RTSP server. I've tried variations with different formats (e.g., mp4 and ts), but the issue persists.

    


    Any insights into resolving this error would be greatly appreciated.

    


  • input/output error with ffmpeg using an input URL in docker

    12 décembre 2023, par Grimou

    I need to use ffmpeg to listen to an rtmp url within a running docker container using ffmpeg.
my ffmpeg command is quite simple : ffmpeg -listen 1 -i rtmp://localhost:1935/live/app ./output.wav

    


    ffmpeg seems to start correctly and listen to the url.

    


    But, when I start the stream (using OBS Studio) I have an input/output error. Here is the logs (with debug log level)

    


    ❯ ffmpeg -loglevel debug -listen 1 -i rtmp://127.0.0.1:1935/live/app ./output.wav
ffmpeg version 5.1.4-0+deb12u1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr --extra-version=0+deb12u1 --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-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-listen' ... matched as AVOption 'listen' with argument '1'.
Reading option '-i' ... matched as input url with argument 'rtmp://127.0.0.1:1935/live/app'.
Reading option './output.wav' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtmp://127.0.0.1:1935/live/app.
Successfully parsed a group of options.
Opening an input file: rtmp://127.0.0.1:1935/live/app.
[NULL @ 0x56288f8e7a00] Opening 'rtmp://127.0.0.1:1935/live/app' for reading
[rtmp @ 0x56288f8e8200] No default whitelist set
[tcp @ 0x56288f8e8d40] No default whitelist set
[rtmp @ 0x56288f8e8200] Proto = rtmp, path = /live/app, app = live, fname = app
[rtmp @ 0x56288f8e8200] New incoming chunk size = 4096
rtmp://127.0.0.1:1935/live/app: Input/output error


    


    The last 3 lines only appear when I start the stream.

    


    It doesn't seems to be a permission problem with the file system, since using ffmpeg -i ./test.mp4 ./output.wav works inside the container.

    


    I also did not find any problem with the network. I am currently using network_mode: "host" in my docker_compose.yml and the logs show that it did receive data before the error appear.

    


    It also doesn't seem to be a problem with the ffmpeg command, since the exact same command works when using it without docker involved.

    


    What else could be the problem ?

    


    here is my docker_compose.yml

    


    version: '3'

services:
  ffmpeg-container:
    build:
      context: .
    network_mode: "host"
    tty: true  # Allocate a pseudo-TTY for interactive use



    


    Dockerfile

    


    FROM python:3

# Install ffmpeg
RUN apt-get update && apt-get install -y ffmpeg

# Create a working directory
WORKDIR app

# Copy the Python script to the container
COPY app.py .
COPY test.mp4 .

# Run the Python script
CMD ["python", "app.py"]