Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
FFMPEG Wierd behaviour for atrim, concat, setpts
22 novembre 2016, par Prasanna MahendiranMy actual app
So actually I was designing an app which uses HTML5 video player. I am capturing the seekbar events and then cutting the video and audio of it. I am storing the breakpoint events from when it seeked and to where it seeked. For example, if 10 second video has [ [1,2], [5,8] ] then it means Video starts from 0 to 1 seeked to 2 then moves till 5 then seeked to 8 then moved till 10.
PROBLEM:
So I wanted to slice a video and then I got the error "Buffer queue overflow, dropping". The frames of both video and audio dropped in the output file. I did a bit of research and found the following flaw. Code1 creates problem but Code2 doesn't create that problem.\
Code1
ffmpeg -i sample_cat.mp4 -filter_complex \ "[0:v]split=2[v0][v1]; [v0]trim=32:34,setpts=N/FRAME_RATE/TB[0v]; [v1]trim=34:37,setpts=N/FRAME_RATE/TB[1v]; [0:a]asplit=2[a0][a1]; [a0]atrim=36:34,asetpts=N/SR/TB[0a]; [a1]atrim=34:37,asetpts=N/SR/TB[1a]; [0v][0a][1v][1a]concat=n=2:v=1:a=1[vv][aa]" -map "[vv]" -map "[aa]" output.mp4
Code2
ffmpeg -i sample_cat.mp4 -filter_complex \ "[0:v]split=2[v0][v1]; [v0]trim=32:34,setpts=N/FRAME_RATE/TB[0v]; [v1]trim=4:37,setpts=N/FRAME_RATE/TB[1v]; [0:a]asplit=2[a0][a1]; [a0]atrim=36:34,asetpts=N/SR/TB[0a]; [a1]atrim=4:37,asetpts=N/SR/TB[1a]; [0v][0a][1v][1a]concat=n=2:v=1:a=1[vv][aa]" -map "[vv]" -map "[aa]" output.mp4
Between the two code there is only one difference. Also I noticed when the subsequent trims have time greater than the current end time of the trim then it doesn't create any problem. Why does it happen like this?
Adding full console output of the error
ffmpeg version 3.2-1~16.04.york1 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.4.1 (Ubuntu 5.4.1-3ubuntu1~ubuntu16.04.1york0) 20161019 configuration: --prefix=/usr --extra-version='1~16.04.york1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-libtesseract --disable-stripping --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-opengl --enable-sdl2 --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-openal --enable-frei0r --enable-libopencv --enable-libx264 --enable-chromaprint --enable-shared libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.100 / 57. 64.100 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample_cat.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.56.100 Duration: 00:04:58.61, start: 0.000000, bitrate: 754 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 4:3 DAR 16:9], 621 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(slv): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Metadata: handler_name : SoundHandler File 'output.mp4' already exists. Overwrite ? [y/N] y [libx264 @ 0x55642fc5cda0] using SAR=4/3 [libx264 @ 0x55642fc5cda0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2 [libx264 @ 0x55642fc5cda0] profile High, level 3.0 [libx264 @ 0x55642fc5cda0] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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 Output #0, mp4, to 'output.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.56.100 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 4:3 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default) Metadata: encoder : Lavc57.64.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream mapping: Stream #0:0 (h264) -> split concat -> Stream #0:0 (libx264) Press [q] to stop, [?] for help [Parsed_concat_5 @ 0x55642fc8ca40] Buffer queue overflow, dropping. Last message repeated 275 times [Parsed_concat_5 @ 0x55642fc8ca40] Buffer queue overflow, dropping.N/A speed= 0x Last message repeated 367 times [output stream 0:0 @ 0x55642fca0b60] 100 buffers queued in output stream 0:0, something may be wrong. frame= 1048 fps=174 q=-1.0 Lsize= 1334kB time=00:00:34.86 bitrate= 313.5kbits/s dup=644 drop=0 speed=5.78x video:1322kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.913387% [libx264 @ 0x55642fc5cda0] frame I:6 Avg QP:18.30 size: 28894 [libx264 @ 0x55642fc5cda0] frame P:398 Avg QP:22.39 size: 2493 [libx264 @ 0x55642fc5cda0] frame B:644 Avg QP:29.79 size: 292 [libx264 @ 0x55642fc5cda0] consecutive B-frames: 15.9% 4.2% 6.6% 73.3% [libx264 @ 0x55642fc5cda0] mb I I16..4: 8.6% 67.7% 23.7% [libx264 @ 0x55642fc5cda0] mb P I16..4: 2.5% 4.9% 0.5% P16..4: 25.4% 6.9% 2.1% 0.0% 0.0% skip:57.6% [libx264 @ 0x55642fc5cda0] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 8.0% 1.0% 0.1% direct: 0.2% skip:90.6% L0:41.2% L1:54.0% BI: 4.7% [libx264 @ 0x55642fc5cda0] 8x8 transform intra:63.4% inter:82.9% [libx264 @ 0x55642fc5cda0] coded y,uvDC,uvAC intra: 45.4% 57.8% 16.4% inter: 3.9% 5.3% 0.5% [libx264 @ 0x55642fc5cda0] i16 v,h,dc,p: 31% 25% 10% 34% [libx264 @ 0x55642fc5cda0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 19% 18% 4% 7% 8% 7% 6% 5% [libx264 @ 0x55642fc5cda0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 15% 11% 4% 8% 10% 6% 6% 4% [libx264 @ 0x55642fc5cda0] i8c dc,h,v,p: 56% 17% 22% 5% [libx264 @ 0x55642fc5cda0] Weighted P-Frames: Y:3.3% UV:2.5% [libx264 @ 0x55642fc5cda0] ref P L0: 76.0% 11.5% 10.2% 2.2% 0.0% [libx264 @ 0x55642fc5cda0] ref B L0: 92.3% 7.1% 0.7% [libx264 @ 0x55642fc5cda0] ref B L1: 96.3% 3.7% [libx264 @ 0x55642fc5cda0] kb/s:309.60
-
How to use ffmpeg for receiving and recording stream without double bandwidth
22 novembre 2016, par DoctorsloI run ffmpeg to get the live stream from camera with this line:
ffmpeg -rtsp_transport tcp -i cameraAddress -f mjpeg pipe:1
The data from pipe is received in C# code, where I also display it to a user.
The camera supports ONVIF protocol, where I receive the events about motion. When the motion is happening, I would like to start recording to a (mp4) file. I would do that simply by running following command:
ffmpeg -rtsp_transport tcp -i cameraAddress Video.mp4
When the recording is happening, I have a double bandwidth from the same camera.
My question is, how can I do this better, preferably without double bandwidth? Is it possible to connect with second ffmpeg to the "pipe:1", which is used as an output in the first ffmpeg?
-
Linking shared libraries (.so) in Android Studio 2.2.2
22 novembre 2016, par fadiI am really stuck and desperate for an answer. I have looked pretty much everywhere online to solve this problem with no real success.
Basically I have compiled ffmpeg for android and I am trying to use the (
.so
) files inside Android Studio 2.2.2.The problem is that I keep getting this error when I try to compile my code Please note that my code worked perfectly under MS Visual Studio and I am certain it works as it should.
I am thinking this error means that I am not linking my shared libraries (
.so
) files against my.cpp
file (correct me if I am wrong).Things I tried:
I have tried including my
.so
files insidemain/jniLibs
, and still didn't work.I put the
.so
files insideapp/libs
, and still no success.Provided linking rules in cmake for example:
add_library(B SHARED IMPORTED) set_target_properties(B PROPERTIES IMPORTED_LOCATION src/main/jniLibs/armeabi-v7a/libavformat-55.so ) include_directories(src/main/cpp/include/) target_link_libraries(native-lib B)
This gave me another error which looks like this:
Error:error: 'src/main/jniLibs/armeabi-v7a/libavformat-55.so', needed by '../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so', missing and no known rule to make it
Here is the structure of my project tree:
I really need help.
-
Can i Cancel or Kill process of convert (video conversion with ffmpeg) ? any command ? [duplicate]
22 novembre 2016, par A SahraThis question is an exact duplicate of:
- How to install ffmpeg for PHP 1 answer
i am using ffmpeg to convert videos ,the process of conversion takes big amount of time How can i Cancel the process while conversion is still going.
-
ffmpeg lost video thumbnail after transcoding
22 novembre 2016, par metlirai've simple question about ffmpeg transcoding. when i transcode an input video (encoder is not important) i lost the thumbnail image for the transcoded one. Is there any easy way to create a thumbnail image while trancoding videos or copy thumbnail image from the input video?
edit: i've realized that this problem occurs when input video and output video encoders are different. Any idea?