Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg avcodec_decode_video2 function error codes
7 mai 2018, par gabyi use at the function
avcodec_decode_video2
at the flowing way:if (packet.isEOF()) { AVPacket eofpkt; av_init_packet(&eofpkt); eofpkt.data = NULL; eofpkt.size = 0; ret = avcodec_decode_video2(d.codec_ctx, d.frame, &got_frame_ptr, &eofpkt); } else { ret = avcodec_decode_video2(d.codec_ctx, d.frame, &got_frame_ptr, (AVPacket*)packet.asAVPacket()); } //qDebug("pic_type=%c", av_get_picture_type_char(d.frame->pict_type)); d.undecoded_size = qMin(packet.data.size() - ret, packet.data.size()); if (ret < 0) { //qWarning("[VideoDecoderFFmpegBase] %s", av_err2str(ret)); return false; } if (!got_frame_ptr) { qWarning("no frame could be decompressed: %s %d/%d", av_err2str(ret), d.undecoded_size, packet.data.size()); return !packet.isEOF(); }
When i run it I get an error (I go inside
if(!got_frame_ptr)
) and in the printing i get that ret value's is: 203,3053,5120 (or more accurate tis is my printings:Warning: "no frame could be decompressed: Error number 203 occurred 0/203" Warning: "no frame could be decompressed: Error number 3053 occurred 0/3053" Warning: "no frame could be decompressed: Error number 5120 occurred 0/5120"
(
av_err2str(ret)
just print decorated ret, nothing more))the
avcodec_decode_video2
docomentatin said:On error a negative value is returned, otherwise the number of bytes used or zero if no frame could be decompressed.
i'm not in situation that avcodec_decode_video2 return me negative value, but i do get zero at got_frame_ptr , instead of got_frame_ptr will be the same value as
ret
like doc. said i get this odd value (203,3053,5120).my questions is:
what this error code means? (i search at ffmpeg doc. and i didn't found a good record on what every numeric value should represent)
why i get this values from this function? is it ffmpeg bug? or did i didn't understand ffmpeg currectly?
thank you g.
-
Can't create thumbnail with ffmpeg
7 mai 2018, par Kirk SteplerI can not create a preview for a video with 4k resolution. Setting: docker image ubuntu 16.04
ffmpeg -i file.MOV -ss 00:00:00 -vframes 1 thumbnail.png
Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> png (native)) Press [q] to stop, [?] for help Killed
-
Building and packaging a portable ffmpeg Linux program ('GLIBC_2.27' not found) [duplicate]
7 mai 2018, par Blue4WhaleThis question already has an answer here:
I am trying to build a portable version of ffmpeg to run on major Linux distributions, with the final user only having to extract the distributed targz package to the appropriate directory.
My previous builds on Ubuntu 16.04 worked fine. I upgraded to Ubuntu 18.04 and new builds, when run on Fedora 27 with
LD_LIBRARY_PATH=. ./ffmpeg
, show errors:./ffmpeg: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by ./libavfilter.so.7) ./ffmpeg: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by ./libavformat.so.58)
Which i interpret as the
libavxxx
libraries want to dynamically link against system librarieslibc
andlibm
that would have been compiled withGLIBC_2.27
, but those libs have been compiled with an older GLIBC version.Note that the fact the errors show from
libavxxx.so
is not the point, as if i compileffmpeg
as a fat binary (libavxxx
linked statically), i get the same error fromffmpeg
.The only workaround i have found so far is to copy the build system
libc.so.6
andlibm.so.6
libraries to the directory containing the binaries and make them part of theffmpeg
package.Is there a better way to handle this issue ?
-
FFmpeg videos not working on QuickPlayer (and therefore on OpenCV)
7 mai 2018, par GabrielleI know that there are several posts about FFMpeg not working on QuickPlayer (and OpenCV) and other players supporting only YUV planar color space, but NONE of the solutions I've found worked for me.
I need it to run on OpenCV, but as far as I found, it will never run on OpenCV if it is not running on QuickPlayer, so, I think I might start fixing the QuickPlayer issue. The generated video is a screen record, and it works perfectly on VLC.
Configurations used:
MacOs High Sierra ffmpeg version 4.0 (installed with: --with-opus --with-libvpx ) opencv version 3.4.1_4 Homebrew 1.6.2 (used to install ffmpeg and opencv)
Command used to record the video:
ffmpeg -f avfoundation -video_size 1980x1140 -framerate 30 -i '1' -vcodec libx264 -preset ultrafast -an -qp 0 -pix_fmt yuv444p video.mkv -y
Note1: I already tried to change
-pix_fmt
toyuv420p
Note2: I already tried to add
-vf scale=640:-2,format=yuv420p
Note3: I already tried to re-install OpenCV
--with-ffmpeg
Note4: I tried
mkv
,mp4
,avi
. I really don't care about the extension, I just need it to work.Note5: I need it to be a cross-plataform solution, as far as I read ffmpeg should work in all OS, but first I am trying to fix on mac and then I will check others...
Any ideas? Maybe a missing flag? A missing library?
@Gyan suggested me to change the qp flag to a number higher than 0, I did it
ffmpeg -f avfoundation -video_size 1980x1140 -framerate 30 -i '1' -vcodec libx264 -preset ultrafast -an -qp 2 -pix_fmt yuv444p video_test.mp4 -y
This is my output:
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers built with Apple LLVM version 9.0.0 (clang-900.0.39.2) configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.3.0/include/openjpeg-2.3 --enable-nonfree libavutil 56. 14.100 / 56. 14.100 libavcodec 58. 18.100 / 58. 18.100 libavformat 58. 12.100 / 58. 12.100 libavdevice 58. 3.100 / 58. 3.100 libavfilter 7. 16.100 / 7. 16.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 1.100 / 5. 1.100 libswresample 3. 1.100 / 3. 1.100 libpostproc 55. 1.100 / 55. 1.100 [avfoundation @ 0x7fbb8f80ee00] Selected pixel format (yuv420p) is not supported by the input device. [avfoundation @ 0x7fbb8f80ee00] Supported pixel formats: [avfoundation @ 0x7fbb8f80ee00] uyvy422 [avfoundation @ 0x7fbb8f80ee00] yuyv422 [avfoundation @ 0x7fbb8f80ee00] nv12 [avfoundation @ 0x7fbb8f80ee00] 0rgb [avfoundation @ 0x7fbb8f80ee00] bgr0 [avfoundation @ 0x7fbb8f80ee00] Overriding selected pixel format to use uyvy422 instead. [avfoundation @ 0x7fbb8f80ee00] Stream #0: not enough frames to estimate rate; consider increasing probesize Input #0, avfoundation, from '1': Duration: N/A, start: 118955.291667, bitrate: N/A Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1440x900, 1000k tbr, 1000k tbn, 1000k tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264)) Press [q] to stop, [?] for help [mp4 @ 0x7fbb8f87d200] Frame rate very high for a muxer not efficiently supporting it. Please consider specifying a lower framerate, a different muxer or -vsync 2 [libx264 @ 0x7fbb8f87f600] MB rate (5130000000) > level limit (16711680) [libx264 @ 0x7fbb8f87f600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 0x7fbb8f87f600] profile High 4:4:4 Predictive, level 6.2, 4:4:4 8-bit [libx264 @ 0x7fbb8f87f600] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=6 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=2 ip_ratio=1.40 aq=0 Output #0, mp4, to 'video_test.mp4': Metadata: encoder : Lavf58.12.100 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1440x900, q=-1--1, 1000k fps, 1000k tbn, 1000k tbc Metadata: encoder : Lavc58.18.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
-
Concatenating two videos with different width and height
7 mai 2018, par TahtakafaIf i try to concatenate two videos it throws an error due to different screen sizes of the videos. I have put a setdat=16/9 parameter like described here for each two video. Then i got the error below. How can i concatenate two videos with different screen sizes?
code:
ffmpeg -i /var/www/html/GetVideo/reklam/muzikli1.mp4 -i /var/www/html/GetVideo/tempvideo/sample.mp4 -filter_complex \ "[0]setdar=16/9[a];[1]setdar=16/9[b]; \ [a][b]concat=n=2:v=1:a=1" /var/www/html/GetVideo/reklam/out.mp4
error:
pi@raspberrypi:/var/www/html/GetVideo $ ffmpeg -i /var/www/html/GetVideo/reklam/muzikli1.mp4 -i /var/www/html/GetVideo/tempvideo/sample.mp4 -filter_complex \ "[0]setdar=16/9[a];[1]setdar=16/9[b]; \ [a][b]concat=n=2:v=1:a=1" /var/www/html/GetVideo/reklam/out.mp4 ffmpeg version git-2018-05-06-652b857 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516 configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree libavutil 56. 18.100 / 56. 18.100 libavcodec 58. 19.101 / 58. 19.101 libavformat 58. 13.101 / 58. 13.101 libavdevice 58. 4.100 / 58. 4.100 libavfilter 7. 21.100 / 7. 21.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/html/GetVideo/reklam/muzikli1.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp41isom Duration: 00:00:13.35, start: 0.000000, bitrate: 244 kb/s Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 918x512 [SAR 1:1 DAR 459:256], 110 kb/s, 5 fps, 5 tbr, 5k tbn, 10k tbc (default) Metadata: handler_name : VideoHandler encoder : AVC Coding Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 129 kb/s (default) Metadata: handler_name : SoundHandler Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/html/GetVideo/tempvideo/sample.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.65.100 Duration: 00:00:25.57, start: 0.000000, bitrate: 1015 kb/s Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 896 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 113 kb/s (default) Metadata: handler_name : SoundHandler [AVFilterGraph @ 0x2fa9a20] No such filter: ' ' Error initializing complex filters. Invalid argument