Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • H264 ByteStream to Image Files

    10 février 2020, par Tzah Mazuz

    first time here so be gentle.

    I've been working for a few weeks on a given H.264 byte stream:

    General notes:

    1. The Byte Stream is not from a file, it is being fed live to me from an external source.
    2. The Byte Stream is encoded with Android's Media Codec.
    3. When writing the stream into a file with a .H264 extension, VLC is able to play it properly.

    What I'm trying to achieve? One of the following:

    1. Converting the frames of the H264 stream to a saveable picture file (png/jpeg etc')

    2. Converting the H264 raw bytes into a MP4 stream that can be played as source by a browser.

    I tried already using JavaCV (FFmpegFrameGrabber) without any success, my main problem is that i have no idea how to parse the byte stream or what each "packet" means

    So, I've attached a text file with some of the packets I'm getting from the stream H264 Packets

  • ffmpeg : Set "year" metadata equal to first 4 characters of another metadata variable (flac)

    10 février 2020, par Hello

    The flac files I am dealing with has an attributed named "Date released", whose value is in the format "YYYY-MM-DD".

    Is it possible for me to take the "YYYY" from this and set the year variable equal to it?

    
        ffmpeg -i input.flac -metadata year=??? -codec copy output.flac
    
    

    Bonus question, is it possible to do this in place without creating a new file? Or would I have to create a new file and then delete the old one?

  • Looping of bash script

    10 février 2020, par Daniel Peters

    Once I start this convertscript.sh I want it to constantly check the files in the directory, if theres an .mkv it will convert it which it does fine at the moment, but when there are no mkv files left it seems to exit out the script, but I want it to loop and keep trying the script constantly.

    Basically if a new file gets added say during the night because the script is looping constantly it picks it up, I don't want to run the convertscript.sh again. I want to run convertscript.sh once initially and then not touch it.

    The script I've got so far is below:

    shopt -s globstar
    for f in **/*.mkv
    do 
        ffmpeg -i "$f" -c:v libx264 -preset ultrafast -minrate 4.5M -maxrate 4.5M -bufsize 9M -c:a ac3 "${f%mkv}mp4";
        [[ $? -eq 0 ]] && rm "$f";
    done
    
  • prevent ffmpeg from opening console window

    10 février 2020, par Yesub

    I have a node/express server which is used to give streams from IP camera to a website. Everything is working well. I run that webserver with PM2 on a windows server.

    The problem : for each stream I have a windows console opening with just nothing logged in. The console reopen when I try to close it.

    Is there a way to prevent those console to open ?

    Here is the related node.js code :

    const { NodeMediaServer } = require('node-media-server');
    
    private _initiate_streams(): void{
        DatabaseProvider.instance.camerasDao.getCamerasList().pipe(
          take(1)
        ).subscribe(
            (databaseReadOperationResult: DatabaseReadOperationResult) => {
                if (databaseReadOperationResult.successful === true){
                  const cameras = databaseReadOperationResult.result;
                  const tasks = [];
                  cameras.forEach( camera => {
                    tasks.push(
                      {
                        app : config.get('media_server.app_name'),
                        mode: 'static',
                        edge: camera.rtsp_url,
                        name: camera.stream_name,
                        rtsp_transport: 'tcp'
                      }
                    )
                  });
    
                  const configMediaServer = {
                    logType: 3, // 3 - Log everything (debug)
                    rtmp: {
                        port: 1935,
                        chunk_size: 60000,
                        gop_cache: true,
                        ping: 60,
                        ping_timeout: 30
                    },
                    http: {
                        port: config.get('media_server.port'),
                        allow_origin: '*'
                    },
                    auth: {
                        play: true,
                        api: true,
                        publish: true,
                        secret: config.get('salt'),
                        api_user: 'user',
                        api_pass: 'password',
                    },
                    relay: {
                        ffmpeg: 'C:\\FFmpeg\\bin\\ffmpeg.exe',
                        tasks: tasks
                    }
                  };
    
                  var nms = new NodeMediaServer(configMediaServer)
                  nms.run();
                } else {
                    // catch exception
                }
            }
        );
      }
    
  • Using ffmpeg WITHOUT x264 or mpeg4

    10 février 2020, par FunkyPizza

    So I've recently started implementing ffmpeg in an application that I do intend to distribute commercially. And I've had an hard time getting my head around the whole licensing process.

    The most commonly answered question I've seen seems to be about x264 which requires a paid licence from x264.org in order to use it commercially (right?). I started to look into mpeg4 instead but that too seemed to be locked behind some licensing fee (https://www.mpegla.com/programs/mpeg-4-visual/license-agreement/).

    I guess my question is the following, what video encoders compatible with FFMPEG are fully free to use?