Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Displaying the current frame of a video after skipping using drawtext/start_number not evaluation any variables

    30 mars 2017, par DJ Quardaboff

    I would like to display the current frame number on a video while playing it with ffplay. I have already seen this solution, but when I seek to any part of the video, the counter resets. There's a variable, start_number, which the ffplay documentation says is The starting frame number for the n/frame_num variable. The default value is "0". It seems that n is set to that when starting the video or seeking between I-frames. I thought setting this variable to %{floor(t*60)} would solve my problem, but after running this:

    ffplay -i "video.mp4" -vf drawtext="fontsize=30:box=1:boxcolor=white:fontcolor=black:fontfile=/Windows/Fonts/arial.ttf:start_number=floor(t*60):text=%{n}"
    

    I got the following console output:

    ffplay version N-84679-gd65b595 Copyright (c) 2003-2017 the FFmpeg developers
      built with gcc 6.3.0 (GCC)
      configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
      libavutil      55. 51.100 / 55. 51.100
      libavcodec     57. 86.103 / 57. 86.103
      libavformat    57. 67.100 / 57. 67.100
      libavdevice    57.  3.101 / 57.  3.101
      libavfilter     6. 78.100 /  6. 78.100
      libswscale      4.  3.101 /  4.  3.101
      libswresample   2.  4.100 /  2.  4.100
      libpostproc    54.  2.100 / 54.  2.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':=    0B f=0/0
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        creation_time   : 2017-03-30T02:49:20.000000Z
        encoder         : Open Broadcaster Software v0.659b
      Duration: 00:05:36.85, start: 0.000000, bitrate: 72636 kb/s
        Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 162 kb/s (default)
        Metadata:
      creation_time   : 2017-03-30T02:49:20.000000Z
      handler_name    : Sound Media Handler
    Stream #0:1(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/iec61966-2-1), 2560x1440, 72465 kb/s, 60 fps, 60 tbr, 1k tbn, 120 tbc (default)
    Metadata:
      creation_time   : 2017-03-30T02:49:20.000000Z
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    [drawtext @ 00000000122770e0] [Eval @ 0000000008f3eb60] Undefined constant or missing '(' in 't*60)'
    [drawtext @ 00000000122770e0] Unable to parse option value "floor(t*60)"
    [drawtext @ 00000000122770e0] [Eval @ 0000000008f3ebd0] Undefined constant or missing '(' in 't*60)'
    [drawtext @ 00000000122770e0] Unable to parse option value "floor(t*60)"
    [drawtext @ 00000000122770e0] Error setting option start_number to value floor(t*60).
    [Parsed_drawtext_0 @ 000000000263eca0] Error applying options to the filter.
    Error initializing filter 'drawtext' with args 'fontsize=30:box=1:boxcolor=white:fontcolor=black:fontfile=/Windows/Fonts/arial.ttf:start_number=floor(t*60):text=%{n}'
       0.01 A-V:    nan fd=   0 aq=   22KB vq= 5866KB sq=    0B f=0/0
    

    In fact, any variable in start_number's assignment invokes this error. I don't know if I have the correct syntax, but does this mean it doesn't evaluate expressions? Or maybe it doesn't accept variables for some reason?

    After that downer I tried just setting the text to %{t}, which played the video, but repeatedly gave this error and had no text in the top left corner:

    [Parsed_drawtext_0 @ 0000000003e54ea0] %{t} is not known 0B f=0/0
    

    So does the current time variable just not work in drawtext?
    Is there another way to write the current frame on the video or even on the console window?

    Using Windows 10 Enterprise and the latest build of ffplay for windows at this time.

  • Is there a way to speed up audio processing (amix and adelay) in FFMPEG ?

    30 mars 2017, par Nadir

    I'm using, in android application, many ffmpeg amix and adelay filter commands over very small mp3 files (not longer than 3 seconds). Unfortunately each adelay or amix command takes between 2 and 4 seconds to execute, which is a lot considering that I should run the same operation for a lot of files. Here are two example of commands I'm running:

    amix:

    [-i, input1.mp3, -i, input2.mp3, -filter_complex, amix=inputs=2:duration=longest:dropout_transition=0,dynaudnorm=f=100[aout], -map, [aout], -ac, 2, -c:a, libmp3lame, -q:a, 4, output.mp3]
    

    adelay:

    [-i, input3.mp3, -filter_complex, [0:a]adelay=1|1, -c:a, libmp3lame, output1.mp3]
    

    I know in video there is an option (-preset ultrafast) to make the execution faster, is there a way to do the same for audio?

  • ffmpeg :How to stop recording when stream shows no signal message

    30 mars 2017, par A Sahra

    I am recording video from a rtsp live stream using ffmpeg and during this process sometimes the camera goes with no signal message at this time i want to stop recording of stream,i have tried it with bitrate that it checks for bitrates every minutes and if bitrate is less than some value eg(bitrate=150) then the condition in my shell script stops the process of recording if not it continues the process,but this i couldn't get consistent result because of variation in value of bitrates.

    My question: How to stop this process(recording) when i get no signal message in my video?

  • PowerShell script ffmpeg

    30 mars 2017, par Karma Elite

    Being the good Windows systems admin that I am, I'm finally getting around to learning PowerShell. With that being said, I have no idea what I'm doing (surprise, surprise).

    I thought that it would be a good learning experience for me to play around with PowerShell at home, far away from my production environment. Recently, I've begun using FFMPEG to convert all of my .mkv files to .mp4 so I could have better playback support to my PlayStation 3 via Plex, and thought that this would be a good learning experience.

    The command I've been running is as follows:

    ffmpeg -i OldVideoName.mkv -vcodec copy -acodec ac3 OldVideoName.mp4
    

    What I want is have a PowerShell script that will run once, scanning a folder and all sub-folders for .mkv files (Get-ChildItem ".*.mkv"), transcode them to .mp4 via the above command, and place them in the same location as the .mkv with the same naming scheme.

    Example of running the script with D:\Videos as the target directory:

    D:\Videos\home_dvr\movies\video1.mkv --> D:\Videos\home_dvr\video1.mp4 D:\Videos\home_dvr\tv\video2.mkv --> D:\Videos\home_dvr\tv\video2.mp4

    As you can guess, I can't figure it out for the life of me. Here's the latest attempt before giving up.

        $oldvid = Get-ChildItem .\*.mkv -Recurse
        $newvid = $oldvid.Name.split(‘.’)[0]; ForEach-Object {
                .\ffmpeg.exe -i $oldvid -y -vcodec copy -acodec ac3 $newvid".mp4”
        }
    

    Any help would be appreciated!

  • ffmpeg pipe response how to play javascript ?

    30 mars 2017, par 최진영

    Hello i have some question

    i trying app.post and response angular2

    here is my code

    function.js

     var url = 'https://www.youtube.com/watch?v=' + id;
     try {
           youtubeStream(url).pipe(res)
         } catch (exception) {
            res.status(500).send(exception)
          } 
    

    response.ts

           this.loading = true 
            var headers = new Headers(); 
            var query = {
                         "videoURL" : this.tracklist[0].videoURL
                        }
             headers.append('Content-Type', 'application/json');
             this.http.post('http://localhost:4100/toMp3',query,{headers: headers}).subscribe((res) => {
                 console.log(res) <-- plz check picture
             });
    

    console.log(res)

    console.log(res)

    I do not know how to play stream data in _body