Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg convert vp9 video to mp4
6 mai 2017, par SulliI am using this command
ffmpeg -i $youtubeUrl -strict -2 -c copy output.mp4
(with $youtubeUrl generated by youtube-dl) to download this youtube video : https://www.youtube.com/watch?v=wnCJhq-JOck
I can't play the downloaded video though on Ubuntu or Windows (for a problem of vp09 codec) and I have to convert the video to webm and then back to mp4 to be able to play it:
ffmpeg -i output.mp4 -vcodec libvpx-vp9 -strict experimental output_2.webm ffmpeg -i output_2.webm -strict 2 output_3.mp4
This happens only with some youtube videos, not all of them.
Is there a way to download all youtube videos in a readable format with only one command line, without having to convert to webm?
-
Why are Cb and Cr planes displaced differently from lum by the displace complex filter in ffmpeg ?
6 mai 2017, par NebI have a video encoded with the yuv420p pixel format and I want to displace its pixels. I'm using ffmpeg and its new displace filter. The filter takes as inputs (the video to be displaced and) two displacement maps respectively for X and Y axis. I decided to create the displacement maps directly into ffmpeg using the nullsrc video source filter and the geq filter to specify the value of the three planes: lum, Cb, Cr. The script is the following:
ffmpeg INPUT.mp4 -f lavfi -i nullsrc=size=${WIDTH}x${HEIGHT}:d=0.1,geq='lum=128+30*sin(2*PI*X/400):Cb=128+30*sin(2*PI*X/400):Cr='128+30*sin(2*PI*X/400)' -f lavfi -i nullsrc=size=${WIDTH}x${HEIGHT}:d=0.1,geq='lum=128+30*sin(2*PI*X/400):Cb=128+30*sin(2*PI*X/400):Cr=128+30*sin(2*PI*X/400)' -lavfi '[0][1][2]displace' OUTPUT.mp4
I used the example provided in the documentation of ffmpeg, since the expression used in geq is irrelevant for the purposes of the problem.
At the and of the computation, I get the pixels of the input video not properly displaced, meaning that I can clearly see a sort of ghost carrying-color-information video under a displaced but b/w one. After some tests, I noticed that the displacemnt map created had only the luma plane displaced correctly while the chrominance planes were displaced, but differently from luma, which is the origin of the planes disalignment in the intput video as you can see in the following extract frames:
I also noticed that the video describing the Cb and Cr planes of the displacement maps have half resolution of the luma plane.
My question is: how can i setup correctly the Cr and Cb planes in the geq definition so that they are exactly identical to the luma plane?
It would be also great if someone could explain me why ffmpeg gives me an output so much different for luma and Cb, Cr planes even if the function provided is the same.
If, it can help, i'm using ffmpeg 3.3-static build.
Thanks for your time.
-
Can't merge mp4 files with FFmpeg on android
6 mai 2017, par BrianI'm using https://github.com/hiteshsondhi88/ffmpeg-android-java in an app that needs to combine multiple mp4 files into one.
Here is a command
ffmpeg -i concat:"/data/data/com.testapp.app/cache:temp/lds82df9skov65i15k3ct16cik.mp4|/data/data/com.testapp.app/cache:temp/qm5s0utmb8c1gbhch6us2tnilo.mp4" -codec copy /data/data/com.testapp.app/cache:temp/4egqalludvs03tnfleu5dgb6iv.mp4
java method to append files, movie files is an array holding files i want to combine
public void appendFiles() { showProgressDialog(); movieFile = getRandomFile(); StringBuilder b = new StringBuilder(); try { for (int i = 0; i < movieFiles.size(); i++) { File f = movieFiles.get(i); if (!f.exists()) { continue; } if(i != 0){ b.append("|"); } b.append(f.getPath()); } final String command = "-i concat:\""+b.toString() + "\" -codec copy " + movieFile.getPath(); try { ffmpeg.execute(command, new ExecuteBinaryResponseHandler() { @Override public void onFailure(String s) { app.log("FAILED with output : " + s); } @Override public void onSuccess(String s) { app.log("SUCCESS with output : " + s); createThumbnail(); stopProgressDialog(); startReview(); } @Override public void onProgress(String s) { app.log("Started command : ffmpeg " + command); } @Override public void onStart() { app.log("Started command : ffmpeg " + command); } @Override public void onFinish() { app.log("Finished command : ffmpeg " + command); } }); } catch (FFmpegCommandAlreadyRunningException e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); } }
and getRandomFile()
public File getRandomFile() { if (captureDir != null) { if (captureDir.exists()) { SecureRandom random = new SecureRandom(); File file = new File(captureDir, new BigInteger(130, random).toString(32) + ".mp4"); return file; } } return null; }
but I keep seeing the error no such file or directory
concat:"/data/data/com.testapp.app/cache:temp/lds82df9skov65i15k3ct16cik.mp4|/data/data/com.testapp.app/cache:temp/qm5s0utmb8c1gbhch6us2tnilo.mp4": No such file or directory
any ideas?
-
How connect OBS with VPS which has ffmpeg for live streaming ?
6 mai 2017, par user7647539Helo I've a VPS on Centos 7 with Apache and ffmpeg. How can I do live streaming on this server using OBS on my local PC to encode and publish to this server and after embed this live video in my wordpress website to allow every device to watch the live video? Thank you all
-
How to install opencv_contrib on Windows ?
6 mai 2017, par How to codeI want to use the
function createFisherFaceRecognizer()
in python,but when I wrote downmodel = cv2.createFisherFaceRecognizer()
orcv2.face.createFisherFaceRecognizer()
Error will occurs:Traceback (most recent call last): File "C:\Users\Administrator\Desktop\My projects\test\RecognizeMe.py", line 5, in model = cv2.face.createFisherFaceRecognizer() AttributeError: 'module' object has no attribute 'face'
I referenced the methods online and found that I should install opencv_contrib.But I was stucked when I was configureing the opencv using CMake. Error:
CMake Error at cmake/OpenCVUtils.cmake:895 (file): file DOWNLOAD HASH mismatch
for file: [E:/opencv-3.1.0/sources/opencv-3.1.0/3rdparty/ffmpeg/downloads/35fe6ccdda6d7a04e9056b0d73b98e76/opencv_ffmpeg_64.dll] expected hash: [35fe6ccdda6d7a04e9056b0d73b98e76] actual hash: [5171a37169c5e695c556c85dc3103d13] status: [28;"Timeout was reached"]
Call Stack (most recent call first): 3rdparty/ffmpeg/ffmpeg.cmake:15 (ocv_download) cmake/OpenCVFindLibsVideo.cmake:206 (include)
CMakeLists.txt:536 (include)CMake Error at cmake/OpenCVUtils.cmake:899 (message): Failed to download opencv_ffmpeg_64.dll. Status=28;"Timeout was reached" Call Stack (most recent call first): 3rdparty/ffmpeg/ffmpeg.cmake:15 (ocv_download) cmake/OpenCVFindLibsVideo.cmake:206 (include)
CMakeLists.txt:536 (include)How to solve this problem?Thank you for your answer!