Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg usb Web cam recording terminates randomly before set duration

    16 mars 2018, par pomptondrive

    The output of this script is just fine; it's pretty much what I want. But it seems to terminate randomly. My next step will be to try this on another computer to see if the issue persists.

    My configuration: Dell Precision laptop, m4400 2x Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz Linux Mint 18.3 Sylvia Kernel: Linux 4.4.0-116-generic (x86_64) Card: NVIDIA G96GLM [Quadro FX 770M] ffmpeg version 2.8.11-0ubuntu0.16.04.1 USB Camera-B4.09.24.1 Sony Playstation Eye

    And this is the script that I'm running - the last time it recorded for about three hours and forty-five minutes, before that it was about 55 minutes; once it ran five and a half hours:

    #!/bin/bash  
    echo "This is a shell script to make a timelapse video."  
    ffmpeg \
    -f v4l2 -input_format yuyv422 -video_size 640x480 -framerate 5 -t 09:00:00 -i /dev/video0 \
    -vf "select=not(mod(n\,5)),setpts=N/(60*TB),fps=60, drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:text='%{localtime\:%T}':x=20:y=20:fontcolor=white" \
    -c:v libx264 -preset superfast -crf 23 -pix_fmt yuv422p -g 15 -keyint_min 15 \
    -f mpegts /media/dkm/OneTB/Video/Timelapse_$(date +%Y-%m-%d_%H.%M.%S).ts
    

    Any suggestions would be appreciated. Thanks!

  • ffmpeg multiple filters need assistance

    16 mars 2018, par Tony Hanna

    I have one movie .mp4, one logo .png and one text (banner) sliding in the bottom, and I need to add subtitles. I'm trying this with complex filters but always with an error. Please help.

    ffmpeg.exe -re -i wonder.mp4 -i logo72.png -filter_complex "[0:v]drawtext=fontcolor=white:fontsize=32:fontfile='C:\Windows\Fonts\arial.ttf':textfile='d:\banner.txt':reload=1:y=h-line_h:x=w-(mod(n*3\,w+tw)-tw/40),drawbox=y=ih-40:color=black@0.4:width=iw:height=40:t=max[text];[text][1:v]overlay=15:15[filtered];[0:v][1:v]overlay=0:0,subtitles=subtitle.srt[out]" -map "[filtered]" - map "[out]" -map 0:a -codec:v libx264 -codec:a copy -f mpegts udp://10.10.10.4:5000?pkt_size=1316
    

    What am I doing wrong?

  • distorted video during ffmpeg h264 video with audio recording

    16 mars 2018, par Developer

    I am continuously recording a video with audio from an ip camera using ffmpeg. I am getting a distorted video when I get in to the picture. If the background is still, the video looks normal, but as soon as I step in to the picture, I see myself only being distorted while the background stays intact. If anyone went through this issue, I would really appreciate your help. Here is a command that I am using:

    ffmpeg -i rtsp://admin:admin@192.168.1.9/mpeg4 -map 0 -c:v libx264 -c:a aac -pix_fmt yuv420p -f segment -segment_time 60 -segment_wrap 10 -reset_timestamps 1 %d.mp4
    

    This is a ffmpeg command output:

    ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
    
    built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
    
     configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-nonfree
    
    libavutil      55. 78.100 / 55. 78.100
    
    libavcodec     57.107.100 / 57.107.100
    
    libavformat    57. 83.100 / 57. 83.100
    
    libavdevice    57. 10.100 / 57. 10.100
    
    libavfilter     6.107.100 /  6.107.100
    
    libavresample   3.  7.  0 /  3.  7.  0
    
    libswscale      4.  8.100 /  4.  8.100
    
    libswresample   2.  9.100 /  2.  9.100
    
    libpostproc    54.  7.100 / 54.  7.100
    

    Guessed Channel Layout for Input Stream #0.1 : mono

    Input #0, rtsp, from 'rtsp://admin:admin@192.168.1.9/mpeg4':
    

    Metadata:

    title           : My MPEG4 Session
    
    comment         : My MPEG4 info
    

    Duration: N/A, start: 0.000000, bitrate: N/A

    Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 30 tbr, 90k tbn, 30k tbc
    
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
    

    Stream mapping:

    Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
    
    Stream #0:1 -> #0:1 (pcm_mulaw (native) -> aac (native))
    
    Press [q] to stop, [?] for help
    
    [aac @ 0x7fc303000600] Too many bits 8832.000000 > 6144 per frame requested, clamping to max
    
    [libx264 @ 0x7fc301846800] using SAR=1/1
    
    [libx264 @ 0x7fc301846800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    
    [libx264 @ 0x7fc301846800] profile High, level 3.0
    
    [libx264 @ 0x7fc301846800] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    
    [segment @ 0x7fc301844400] Opening '0.mp4' for writing
    

    Output #0, segment, to '%d.mp4':

    Metadata:

    title           : My MPEG4 Session
    
    comment         : My MPEG4 info
    
    encoder         : Lavf57.83.100
    
    Stream #0:0: Video: h264 (libx264), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 30 fps, 15360 tbn, 30 tbc
    
    Metadata:
    
      encoder         : Lavc57.107.100 libx264
    
    Side data:
    
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    
    Stream #0:1: Audio: aac (LC), 8000 Hz, mono, fltp, 48 kb/s
    
    Metadata:
    
      encoder         : Lavc57.107.100 aac
    
    frame=   57 fps=0.0 q=29.0 size=N/A time=00:00:02.04 bitrate=N/A dup=22 drop=0 sframe=   73 fps= 68 q=29.0 size=N/A time=00:00:02.56 bitrate=N/A dup=22 drop=0 s
    
    frame=   89 fps= 54 q=29.0 size=N/A time=00:00:03.07 bitrate=N/A dup=22 drop=0 sframe=  106 fps= 48 q=29.0 size=N/A time=00:00:03.58 bitrate=N/A dup=22 drop=0 s
    
    frame=  122 fps= 45 q=29.0 size=N/A time=00:00:04.09 bitrate=N/A dup=22 drop=0 sframe=  137 fps= 42 q=29.0 size=N/A time=00:00:04.48 bitrate=N/A dup=22 drop=0 s
    
    frame=  151 fps= 40 q=29.0 size=N/A time=00:00:04.97 bitrate=N/A dup=22 drop=0 s
    
    frame=  156 fps= 37 q=-1.0 Lsize=N/A time=00:00:05.48 bitrate=N/A dup=22 drop=0 speed= 1.3x  
    

    Update: It works fine in vlc player. I am adding a link to the destorted video: https://drive.google.com/file/d/1QCc7XUbePBI3v1h0sNQgU0guHA2AwgRT/view?usp=sharing

  • Does this FFMPEG command create videos compatible with ABR playback on video.js player ?

    16 mars 2018, par alchemical

    We're working on a site that will allow users to upload videos. It then encodes these videos into 4 bitrates. The initial version just lets the user manually select which of the 4 version they would like to play. However, the final version should allow for adaptive bitrate ABR using video.js player. Ideally, we should not need to re-encode the videos again for them to stream with ABR.

    I'm trying to understand if the current FFMPEG statement will support ABR:

    -i \"{0}\" -i \"{1}\" -threads {5} -filter_complex \" [0:v]scale=-2:{2}[bg];[1:v]scale=-2:40*{2}/1080[watermark_scaled];[bg] [watermark_scaled]overlay=x=main_w-overlay_w-(10* {2}/1080):10*{2}/1080\" -acodec copy -vcodec libx264 -b:v {3} \"{4}\"

  • FFMPEG 1080p50 to 1080p25 bad channel logo [on hold]

    16 mars 2018, par Sambir

    I try to run ffmpeg and gpu encoding. The input stream is 1080p50 (which is 1080i50 to 1080p25 and then to p50 again). I want to transcode this @ 1080p25 but the output is not really smooth. The corners of the channel logo are not smooth and when small letters goes across the screen they are not smooth aswell.

    But when transcode @ 1080p50 then all is fine. But you can see the logo shaking. Its like running @ 720p50.

    Is there a way i can make the logo look smooth @ 1080p25? I tried using vf yadif and it helped a bit but the logo is a bit blurry now.

    With gpu deinterlacing it's worse.

    This is my current command line

    ffmpeg.exe -vcodec h264_cuvid -i rtmp://192.168.2.3:8001/input/channel -map 0:0 -map 0:1 -vf yadif=1 -acodec libfdk_aac -b:a 96k -c:v h264_nvenc -gpu 0 -preset llhq -vprofile high -rc:v vbr -qmin:v 26 -qmax:v 32 -b:v 4M -maxrate 4M -bufsize 8M -threads 0 -r 25 -g 100 -f flv rtmp://192.168.2.3:8001/input/test10.stream