Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
FFmpeg-Unable to find a suitable output format for FONTCONFIG_FILE
28 mai 2017, par StrangerI am using below ffmpeg command to draw text on top of video-
String path=getFilesDir()+"/fonts.conf"; String[] complexCommand ={"-i", inputFilePath,"FONTCONFIG_FILE="+path,"-vf","drawtext=fontfile=/assets/fonts/formataregular.otf: \\text='Stack Overflow: fontcolor=white: fontsize=24: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2'","-codec:a","copy",outputFilePath};
I am using WritingMinds/ffmpeg-android and i have followed instruction-
If you want to use FONTCONFIG then you need to specify your custom fontconfig config file (e.g - "FONTCONFIG_FILE=/sdcard/fonts.conf ./ffmpeg --version", where /sdcard/fonts.conf is location of your FONTCONFIG configuration file)
My configuration file is stored in Internal Storage of device with name
fonts.conf
I am getting below error-
Unable to find a suitable output format for 'FONTCONFIG_FILE=/data/data/videoeditor.bhuvnesh.com.ffmpegvideoeditor/files/fonts.conf' FONTCONFIG_FILE=/data/data/videoeditor.bhuvnesh.com.ffmpegvideoeditor/files/fonts.conf: Invalid argument
I also tried path as-
File dir=Environment.getExternalStorageDirectory(); String path=dir.getAbsolutePath()+"/fonts.conf";
Where am i going wrong?
-
How can I compress or change the resolution of the video very fast with FFmpeg ?
28 mai 2017, par RaresI would like to compress or change the resolution of the video before sending it to server but I don't want to take too long. For example for the following code a video with size 100MB it takes 2-3 min to resize it to 10MB. Can I do it faster without losing too much quality?
String[] command = {"-i", filePath, "-vf", "scale=640:360", "-c:a", "copy", "-preset", "ultrafast", dest.getAbsolutePath()};
Console output for above command:
05-28 11:50:22.131 23323-23323/com.example.rares.peoplecounterapp D/TestFFmpeg: SUCCESS with output : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (GCC) configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags= libavutil 55. 17.103 / 55. 17.103 libavcodec 57. 24.102 / 57. 24.102 libavformat 57. 25.100 / 57. 25.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 31.100 / 6. 31.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/DCIM/Camera/20170501_212606.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2017-05-01 18:26:46 com.android.version: 6.0 Duration: 00:00:38.70, start: 0.000000, bitrate: 17203 kb/s Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 17007 kb/s, SAR 1:1 DAR 16:9, 29.98 fps, 29.92 tbr, 90k tbn, 180k tbc (default) Metadata: creation_time : 2017-05-01 18:26:46 handler_name : VideoHandle Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 155 kb/s (default) Metadata: creation_time : 2017-05-01 18:26:46 handler_name : SoundHandle [libx264 @ 0xf7344400] using SAR=1/1 [libx264 @ 0xf7344400] using cpu capabilities: none! [libx264 @ 0xf7344400] profile Constrained Baseline, level 3.0 [libx264 @ 0xf7344400] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=0 threads=9 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=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0 Output #0, mp4, to '/storage/emulated/0/DCIM/Camera/20170501_212606_compressed97.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 com.android.version: 6.0 encoder : Lavf57.25.100 Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 29.92 fps, 11488 tbn, 29.92 tbc (default) Metadata: creation_time : 2017-05-01 18:26:46 handler_name : VideoHandle encoder : Lavc57.24.102 libx264 Side data: unknown side data type 10 (24 bytes) Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 155 kb/s (default) Metadata: creation_time : 2017-05-01 18:26:46 handler_name : SoundHandle Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 6 fps=0.0 q=0.0 size= 0kB time=00:00:01.04 bitrate= 0.4kbits/s speed=1.96x frame= 15 fps= 05-28 11:50:22.132 23323-23323/com.example.rares.peoplecounterapp D/TestFFmpeg: Finished command :ffmpeg [Ljava.lang.String;@d8854f
-
How to read the Y, U, V of each pixel from the YUV format image [on hold]
28 mai 2017, par xinyue LiuI'm currently have a YUV image. Do you have any suggestion on how to extract y,u,v components of each pixel from the image?
-
How can I change a video frame rate with FFmpeg keeping the same total number of frames ?
28 mai 2017, par NunoI've been searching for an answer here on Stack Overflow and googling everywhere... even though it seems like it should be a very simple command line to me, I just can't find an answer anywhere.
I would like to change the frame rate of a video from 23.976fps to 24fps with FFmpeg, lossless and keeping the total number of frames.
To make it simpler:
Let's say I have a 25fps video with a total lenght of 100 frames.
How can I change it's frame rate to 50fps, with FFmpeg, lossless and keeping the same total lenght of 100 frames?
This was so far the best solution I came across with (which can be found here):
Extract the frames as rawvideo:
ffmpeg -i input.mov -f rawvideo -b 50000000 -pix_fmt yuv420p -vcodec rawvideo -s 1920x1080 -y temp.raw
Recreate the video with new framerate:
ffmpeg -f rawvideo -b 50000000 -pix_fmt yuv420p -r 24 -s 1920x1080 -i temp.raw -y output.mov
Note 1: I had to remove "-b 50000000" when recreating the video with the new frame rate, in order to get it to work properly.
It did exactly what I intended it to do, but I'm still wondering if there is any simpler way to do this? I've tried to pipe them together in one line only, as suggested in the same post, but couldn't get it to work.
Note 2: Even though it does exactly what I wanted it to do, I've just later realized there is quality loss using this method, which I would prefer to avoid.
Thanks everyone in advance!
-
How to upload a video through PHP, transcode it via FFmpeg and upload it to a different server via FTP
28 mai 2017, par PBXAICurrently I am building a video streaming platform and I need a way to upload my videos, through multiple resolutions to my Wowza server. I am currently running Ubuntu with Nginx, PHP and Wowza so I want to be able to, when the user uploads the video, encode it to 1080p, 720p, 480p, and 360p. How would I do this?