Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
FFmpeg C++ Library building issue [on hold]
13 septembre 2019, par Ahtazaz khanI'm trying to integrate FFmpeg library in my Xcode project, And following this Stackoverflow Question. As I follow each and every step from that Question, But at the end got this compiler error.
Here is a screenshot of Libraries Error. Any Help will be highly appreciated. Thanks
-
Crop video scale square to round shape -Android
13 septembre 2019, par AdilCurrently I'm developing video editing app, in which i want to overlay video to image i used FFMPEG library and use overlay command and export video to video.mp4 format
Here is done with overlay command :
private void extractImagesVideo() { File moviesDir = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES ); String filePrefix = "extract_picture"; String fileExtn = ".mp4"; File dir = new File(moviesDir, "VideoEditor"); int fileNo = 0; while (dir.exists()) { fileNo++; dir = new File(moviesDir, "VideoEditor" + fileNo); } dir.mkdir(); File dest = new File(dir, filePrefix + "%03d" + fileExtn); Log.d(TAG, "startTrim: dest: " + dest.getAbsolutePath()); // String complexCommand[]={"-y","-i",mStrImagePath,"-i",mStrVideoPath,"-filter_complex","[0]scale=720:1280:force_original_aspect_ratio=decrease,drawbox=x=10:y=10:w=100:h=100:color=pink@0.5:t=max: (ow-iw)/2:(oh-ih)/2,setsar=1[backd],[backd][1] overlay=x=(main_w-overlay_w)/(main_w-overlay_w):y=(main_h-overlay_h)","-acodec","copy",dest.getAbsolutePath()}; String complexCommand[]={"-y","-i",mStrVideoPath,"-f","lavfi","-i","color=c=black:s=1920x1080","-filter_complex","[0:v]scale=w=0.80*iw:h=0.80*ih[scaled],[1:v][scaled]overlay=x=0.10*main_w:y=0.10*main_h:eof_action=endall[out]","-acodec","copy",dest.getAbsolutePath()}; // String complexCommand[]={"-y","-i",mStrImagePath,"-i",mStrVideoPath,"-filter_complex","[1:v] scale=200:200 [ovr1], [1:v] scale=200:200 [ovrl2], [0:v][ovr1] overlay=25:25:enable='between(t,0,20)' [temp1], [temp1][ovrl2] overlay=50:50:enable='between(t,20,40)'","-acodec","copy",dest.getAbsolutePath()}; // String complexCommand[]={"-y","-i",mStrImagePath,"-i",mStrVideoPath,"-filter_complex","[0]scale=1024:1280:force_original_aspect_ratio=decrease,pad=1024:1280:(ow-iw)/2:(oh-ih)/2,setsar=1[backd],[backd][1] overlay=x=(main_w-overlay_w)/(main_w-overlay_w):y=(main_h-overlay_h):shortest=1","-acodec","copy",dest.getAbsolutePath()}; /* Remove -r 1 if you want to extract all video frames as images from the specified time duration.*/ execFFmpegBinary(complexCommand); }
Issue is video showing square shape i want to crop video into rounded shape, i check almost solutions and check also FFMPEG commands , i found mask overlay on video but isn't a proper solution
-
How to add compression to ffmpeg command
13 septembre 2019, par balfredI am trying to add a good level of compression to the following ffmpeg command or if it is already good can you help me understand?
I have seen that people might have luck using this command but I dont know how to merge it into mine
ffmpeg -i sourceFilePath -vcodec h264 -acodec mp3 newFilePath
This is my current command that I am using that I need help understanding why the previous command might be a better solution but how to implement my additional arguments
ffmpeg -i sourceFilePath -vcodec libx264 -profile:v baseline -level 3 newFilePath
I want to see optimal compression and still have my existing functionality using my additional arguments. I dont know what will produce the best results, this is out of my area of expertise.
-
Can you stream video with ffmpeg and opencv without long buffers
13 septembre 2019, par steveI'm successfully getting a video stream using ffmpeg, and displaying with opencv, but the video starts and stops very often and is not as smooth as when played on a browser. Is there a way to get the video stream to be as smooth as on a browser?
I've tried playing with ffmpeg parameters as well as having multiple pipes to stitch together a single video.
import cv2 import numpy as np import subprocess as sp import time # Playlist manifest for video from Nevada DOT traffic camera VIDEO_URL = "https://wowza1.nvfast.org/bmw3/charleston_and_fremont_public.stream/playlist.m3u8" width = 360 height = 240 pipe = sp.Popen([ 'ffmpeg', "-i", VIDEO_URL, "-loglevel", "quiet", # no text output "-an", # disable audio "-f", "image2pipe", "-pix_fmt", "bgr24", "-r", "15", # FPS "-hls_list_size", "3", #"-hls_time", "8" "-vcodec", "rawvideo", "-"], stdin = sp.PIPE, stdout = sp.PIPE) while True: # Convert bytes to image raw_image = pipe.stdout.read(width*height*3) # read 432*240*3 bytes (= 1 frame) img = np.fromstring(raw_image, dtype='uint8').reshape((height,width,3)) raw_image = np.copy(img) # Show image cv2.imshow('pipe', img) cv2.waitKey(1) time.sleep(0.05) # This is to slow down the video so it plays more naturally
The expected output is a opencv window that displays the video just like in https://cctv.nvfast.org/
I assume the problem lies in ffmpeg not getting the video chunks.
-
Cannot Compile C Program That Uses a Library (FFmpeg) with GCC Because of the Library's Include Statements
12 septembre 2019, par NetherGraniteI am unable to compile a C project that uses a library called "FFmpeg" with a compiler called "GCC", and I believe it might be either because I don't quite understand how
#include
works or because I am using the wrong compilation process.In a folder called
Test
, I have a fileTest/test.c
with the following contents:#include #include #include "FFmpeg/libavcodec/avcodec.h"
The folder
FFmpeg
is located atTest/FFmpeg
. When I try to compile this with GCC, I receive the following error:fatal error: libavutil/samplefmt.h: No such file or directory
The file
Test/FFmpeg/libavcodec/avcodec.h
has the following code in it:#include "libavutil/samplefmt.h" #include "libavutil/attributes.h" #include "libavutil/avutil.h" ... //many more #include statements
Is the issue here that I need to add "
FFmpeg/
" to all of these include statements?If so, is there a way to automatically do this? This library is enormous and probably has hundreds of these statements.
If not, what should I be doing instead? Should I attempt to compile the library by itself? If so, how do I then include this compiled version of the library in my program?
Notes:
- The command I am using to compile is
gcc -c test.c
. - I have GCC installed via MinGW.
- I ultimately need to be able to compile this program to both a
.dll
and an.so
.
I apologize if any of the terminology I use here is incorrect or if my explanations are poor. I know almost nothing about compilation. Please let me know if I need to fill in more information.
- The command I am using to compile is