Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg : add 1 second repeating last frame to video without reencoding
21 août 2017, par user3379855I want to add 1 second to a video showing the last frame in silence.
How can I achieve this using ffmpeg without reencoding the video?
-
FFmpeg raw audio and H264 in RTSP
21 août 2017, par Max RidmanTrying to grab correctly video and audio data from an IP camera Hikvision.
Everything works like a charm when doing so for H264 + MP2 for example.
When trying to grab RAW audio in PCM s16le - smile goes off of my face.
Here is how I grab my camera:
ffmpeg -re -acodec pcm_s16le -ac 1 -rtsp_transport tcp -i rtsp://ipcameraaddress:554 -vcodec copy -acodec libfdk_aac -vbr 5 test.ts
The command works and packs RTSP stream to a TS file.
However the duration of audio and video is different. For an example, I am recording 21 sec, from that I have 21 sec of Audio and 15 of Video.
The audio is being stretched and pitch is lowered. Have spent several days reading FFmpeg documentation and applied various options like async, changing sample rate and so on - no luck.
I hope Mulvya or other FFmpeg experts will advice me a FIX to get things done correctly.
-
Python & OpenCV - VideoCapture.read() always returns false
21 août 2017, par JulenI need to extract frames from a video at a given time, and I'm using OpenCV for it. I'm using Linux Mint 18.1, but it must also run on Ubuntu.
This code example is not working for me:
import cv2 print('making screenshot from {0}'.format('/tmp/big_buck_bunny_720p_5mb.mp4')) cap = cv2.VideoCapture(video_path) cap.set(cv2.CAP_PROP_POS_MSEC,1000) ret,frame = cap.read() print(ret) # This is false cv2.imwrite("image.jpg", frame) # Creates an empty file
(I've checked that the path of the video is correct and that the file is not corrupted).
I have installed the Python OpenCV 3.3.0 version:
>>> import cv2 >>> cv2.__version__ '3.3.0'
I've compiled and installed the source for OpenCV (with the
WITH_FFMPEG=ON
option):git clone https://github.com/Itseez/opencv.git /tmp/opencv-3 /tmp/opencv-3 mkdir -p release cd release cmake -D WITH_FFMPEG=ON -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. make sudo make install
The output of
ffmpeg -version
is the following:ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --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-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100
What am I missing?
-
How to force to work Vitamio on targetsdk more than 23 ?
21 août 2017, par Alex D.I really need to use vitamio player, but i have target sdk 23 (or higher). When i try to use - it say to me
LOAD FFMPEG ERROR: dlopen failed: /.../lib/arm/libffmpeg.so: has text relocations
So, how i can to use this video player on 23 target sdk?
-
What FFMPEG return when camera is disabled (unplug)
21 août 2017, par hungI use FFMPEG to connect to a IP camera via RTSP stream. I try to detect if connection is lost. I create timeout with interrupt_callback, and check the output of av_read_frame(), sometime it work and can reconnect to camera. But if I disable the camera (unplug the network cable), it's blocked and pause forever. Hope someone has similar issue and can help me. Here what I try:
Setting for interrupt_callback:
ifmt_ctx = avformat_alloc_context(); ifmt_ctx->interrupt_callback.callback = interruptCallback; ifmt_ctx->interrupt_callback.opaque = this; if ((ret = avformat_open_input(&ifmt_ctx, in_file, 0, &options)) != 0) { log.error("Could not open input stream {}", in_file); return 1; }
interrupt_callback function:
int CtFfmpeg::interruptCallback(void *ctx) { CtFfmpeg* camera = reinterpret_cast(ctx); struct tm *tm; time_t now; now = time(0); tm = localtime (&now); int nowTime_callback = tm->tm_sec; if ((nowTime_callback - camera->initTime_callback) > 15) { //Timeout after 20 seconds Logger log{__func__}; log.error("Time out"); return 1; } return 0; }
Try to restart connection:
ff->ret = av_read_frame(ff->ifmt_ctx, &(ff->tmp_pkt)); if (ff->ret < 0){ // do restart here }