Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Name ffmpeg generated images using timestamp rather than sequential numbers
15 décembre 2015, par weotchAs far as I can tell from the ffmpeg docs, they don't provide a way to use timestamps in the filename rather than sequential numbers. What they provide allows you to create 0001.jpg, 0002.jpg, 0003.jpg but not 2011-08-01 7:30:00.jpg, 2011-08-01 7:30:01.jpg, 2011-08-01 7:30:02.jpg. Can anyone think of a solution that could take the sequentially named files from ffmpeg and name them using their created time?
-
image -> video -> image not lossless using avconv
15 décembre 2015, par nrobI'm trying to test the amount of information lost with some different video codecs. I've got a python script which uses PyPNG to write a series of 8 bit RGB images. I then encode it using avconv, for instance
avconv -r 1 -i ../frames/data%03d.png -c:v ffv1 -qscale:v 0 -r 1
outffv1.avi
I then decode this back into pngs like so
avconv -r 1 -i outffv1.avi -r 1 ./outffv1/frame%03d.png
But when I compare the images before and after the video compression, they are different (mean absolute error of ~~15%). The thing that is confusing me is that this is true (give or take) independent of the codec.
For instance, I get similar answers for libtheora for a range of qscale values.
The png encoding i.e. write to png, and immediately load back in without and video compression step, is lossless.
-
Proportion for the values of maxrate, mnrate and bufsize for encoding videos for streaming purpose and past duration too large warning
15 décembre 2015, par himanshu nautiyalcan you please tell me about minrate, maxrate and bufsize. And is it necessary to give maxrate and minrate for encoding videos for streaming purpose. Actually I understood the meaning and functions of minrate, maxrate and bufsize through ffmpeg documents but I am not finding any solution of what would be difference in between the values of these three.
for example : I am using this command ffmpeg -y -i testing.mp4 -c:a libfdk_aac -ac 2 -ab 128k -c:v libx264 -r 24 -g 24 -b:v 2m -maxrate 1m -bufsize 1m -vf scale=1920*1080 aa.mp4
but I am not sure if this -b:v 2m -maxrate 1m bufsize 1m is in correct propotions or not. My output is fine but I don't want any problem on working real time. Moreover, I am also getting the following warning
Past duration 0.634361 too large Past duration 0.674370 too large Past duration 0.714363 too large 0kB time=00:00:01.32 bitrate= 0.3kbits/s
Past duration 0.754372 too large Past duration 0.794365 too large Past duration 0.834373 too large Past duration 0.874367 too large Past duration 0.914360 too large Past duration 0.954369 too large
thanks in advance
-
Convert .MOV video format to .mp4 format
15 décembre 2015, par Nimesh ChandramaniyaI am developing an Android app, for which I need to convert videos with .MOV file extension (captured on iOS device) to .mp4 file extension. I tried changing the extension of the file via code (i.e. from MOV to mp4) but this approach didn’t work.
During my research I came across FFMPEG framework to work with different video file formats and I have the following questions:
- Is it possible to convert video file format using FFMPEG framework? If yes, are there any online tutorials available on how to use this framework in Android?
- Are there any Android API using which I can use to retrieve raw data (uncompressed) of any video file? (If I can retrieve raw data, it’s easier to convert it to a desired file format)
I’d appreciate any suggestions on this issue. Thank you in advance.
-
Unable to merge videos in Android using JavaCV ("Sample Description" Error)
15 décembre 2015, par SanI am creating a video from images via FFMPEG and I am able to get the video from images. I am also making use of JavaCV to merge two videos and I am able to join videos using JavaCV without any issues provided both the videos are taken via camera, i.e, a video actually recorded via mobile camera.
Issue that I'm facing :
I am not able to merge the video that was generated from FFMPEG using the images along with the video user has chosen which will mostly be a video that was not generated and taken via mobile camera.
CODE : Code to generate Video via Images :
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(path + "/" + "dec16.mp4", 800, 400); try { recorder.setVideoCodec(avcodec.AV_CODEC_ID_MPEG4); //recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264); recorder.setVideoCodecName("H264"); recorder.setVideoOption("preset", "ultrafast"); recorder.setFormat("mp4"); recorder.setFrameRate(frameRate); recorder.setVideoBitrate(60); recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P); startTime = System.currentTimeMillis(); recorder.start(); for(int j=0;j recorder.getTimestamp()) { recorder.setTimestamp(t); recorder.record(image); } } recorder.stop(); } catch (Exception e) { e.printStackTrace(); }
Code to merge Videos :
int count = file_path.size(); System.out.println("final_joined_list size " + file_path.size()); if (file_path.size() != 1) { try { Movie[] inMovies = new Movie[count]; mediaStorageDir = new File( Environment.getExternalStorageDirectory() + "/Pictures"); for (int i = 0; i < count; i++) { File file = new File(file_path.get(i)); System.out.println("fileeeeeeeeeeeeeeee " + file); System.out.println("file exists!!!!!!!!!!"); FileInputStream fis = new FileInputStream(file); FileChannel fc = fis.getChannel(); inMovies[i] = MovieCreator.build(fc); fis.close(); fc.close(); } List
Error :
The Error that I am facing while trying to merge the videos generated via Images and a normal video is
12-15 12:26:06.155 26022-26111/? W/System.err﹕ java.io.IOException: Cannot append com.googlecode.mp4parser.authoring.Mp4TrackImpl@45417c38 to com.googlecode.mp4parser.authoring.Mp4TrackImpl@44ffac60 since their Sample Description Boxes differ 12-15 12:26:06.155 26022-26111/? W/System.err﹕ at com.googlecode.mp4parser.authoring.tracks.AppendTrack.
(AppendTrack.java:48) Fix that I tried :
Google advised me to change the CODEC in JavaCV from
avcodec.AV_CODEC_ID_MPEG4
toavcodec.AV_CODEC_ID_H264
. But when I did that, I am not able to get the video from images thereby throwing the following error :12-15 12:26:05.840 26022-26089/? W/linker﹕ libavcodec.so has text relocations. This is wasting memory and is a security risk. Please fix. 12-15 12:26:05.975 26022-26089/? W/System.err﹕ com.googlecode.javacv.FrameRecorder$Exception: avcodec_open2() error -1: Could not open video codec. 12-15 12:26:05.975 26022-26089/? W/System.err﹕ at com.googlecode.javacv.FFmpegFrameRecorder.startUnsafe(FFmpegFrameRecorder.java:492) 12-15 12:26:05.975 26022-26089/? W/System.err﹕ at com.googlecode.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:267)
What I need :
Creating video from Images is inevitable and that video will definitely be used to merge with other videos which might have any Codec Formats. So I need to find a way to merge any kind of videos irrespective of their Codecs or any other parameters. I am trying to keep it simple by just using the Jars and SO files and I dont want to drive myself crazy by going on a full scale implementation of FFMPEG Library. That being said, I am also ready to look into that library if I dont have any other ways to achieve what I want but a solid resource with an ALMOST working code would be much appreciated. Cheers.
Update : I looked upon the issues mentioned at GitHub of OpenCV, but didnt find anything solid from it. OpenCV Issues