Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
GIF to video conversion using FFmpeg [on hold]
12 mai 2018, par Mehmet KurtgozHi I want to convert gif file to video file using FFmpeg.
My library:
implementation 'com.writingminds:FFmpegAndroid:0.3.2'
and the way the code is written:
String[] commands = { "-i", inputfile, "-movflags", "faststart", "-pix_fmt", "yuv420p", outputFile };
I get an error in this code. Other examples on the Internet do not fit into the library I use. Can you help me ?
-
Android - Gif to Video convert FFmpeg
12 mai 2018, par Mehmet KurtgozHi I want to convert gif file to video file using FFmpeg.
My library:
implementation 'com.writingminds:FFmpegAndroid:0.3.2'
and the way the code is written:
String[] commands = { "-i", inputfile, "-movflags", "faststart", "-pix_fmt", "yuv420p", outputFile };
I get an error in this code. Other examples on the Internet do not fit into the library I use. Can you help me ?
-
Convert video to mp4 format in Asp Core 2
12 mai 2018, par AlTheSwedeI have tried MediaToolkit as well as NReco.video converter, both works great on ASP.Net but not in core. I tried using MediaToolkit.NetCore which is in early stage but I have not been able to get it to work on ASP Core 2.
With MeidaToolkit.NetCore i tried this:
var inputFile = new MediaFile {Filename = @"C:\Path\To_Video.flv"};
var outputFile = new MediaFile {Filename = @"C:\Path\To_Save_New_Video.mp4"};
using (var engine = new Engine())
{ engine.Convert(inputFile, outputFile);}
But the problem is that ffmpeg.exe is not embedded in library binaries, so you have to pass a path to ffmpeg.exe explicitly in the constructor, which I don't know how to do.
How can I pass the ffmpeg.exe in the constructor above or is there another free FFmpeg wrapper or similar that I can use in order to convert most common video formats into .mp4 format that works on ASP Core 2.x?
-
Auto resize video with ffmpeg based on input video resolution
12 mai 2018, par Masoud MohammadiI wrote a Bash script to convert all video files in a directory. Some videos are 1280 x 720 resolution, and others are 720 x 1280.
How can I write a
ffmpeg
command that converts 1280 x 720 videos to 640 x 360 and 720 x 1280 videos to 360 x 640? -
ffmpeg - duration usage in input text file
12 mai 2018, par VoicuI am trying to use ffmpeg to concatenate video segments with some black screen. To do that I've first generated a blank 10-second video (no audio track) with:
$ ffmpeg -f lavfi -i color=black:s=320x240:r=1 -f lavfi -i anullsrc -t 10 -vcodec libvpx -an blank.mkv
I then created the simplest possible scenario within input.txt file (contents below) in order to have three seconds of black screen followed by some video (no audio track):
file 'blank.mkv' duration 3 file 'video_example.mkv'
And, finally, ran the following ffmpeg command to concat the contents of that input file:
$ ffmpeg -f concat -i input.txt -codec:v copy -codec:a copy output.mkv
The issue that I have is that the
duration 3
is not considered, so the final video still has ten seconds of black frames (instead of three) followed by my video. And also "Non-monotonous DTS in output stream 0:0 ..." message is shown when usingduration x
in the file. If I remove duration the warnings are gone and getting the 10-second black screen first output as well.Full output of the ffmpeg concat command:
$ ffmpeg -hide_banner -f concat -i input.txt -codec:v copy -codec:a copy output.mkv Input #0, concat, from 'input.txt': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: vp8, yuv420p(progressive), 320x240, SAR 1:1 DAR 4:3, 1 fps, 1 tbr, 1k tbn, 1k tbc Metadata: ENCODER : Lavc57.107.100 libvpx DURATION : 00:00:10.000000000 File 'output.mkv' already exists. Overwrite ? [y/N] y Output #0, matroska, to 'output.mkv': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: vp8 (VP80 / 0x30385056), yuv420p(progressive), 320x240 [SAR 1:1 DAR 4:3], q=2-31, 1 fps, 1 tbr, 1k tbn, 1k tbc Metadata: ENCODER : Lavc57.107.100 libvpx DURATION : 00:00:10.000000000 Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help [concat @ 000000000031a440] DTS 3000 < 9000 out of order [matroska @ 0000000000328420] Non-monotonous DTS in output stream 0:0; previous: 9000, current: 3000; changing to 9000. This may result in incorrect timestamps in the output file. [matroska @ 0000000000328420] Non-monotonous DTS in output stream 0:0; previous: 9000, current: 4001; changing to 9000. This may result in incorrect timestamps in the output file. [matroska @ 0000000000328420] Non-monotonous DTS in output stream 0:0; previous: 9000, current: 4998; changing to 9000. This may result in incorrect timestamps in the output file. [matroska @ 0000000000328420] Non-monotonous DTS in output stream 0:0; previous: 9000, current: 6004; changing to 9000. This may result in incorrect timestamps in the output file. [matroska @ 0000000000328420] Non-monotonous DTS in output stream 0:0; previous: 9000, current: 7002; changing to 9000. This may result in incorrect timestamps in the output file. [matroska @ 0000000000328420] Non-monotonous DTS in output stream 0:0; previous: 9000, current: 8005; changing to 9000. This may result in incorrect timestamps in the output file. frame= 5794 fps=0.0 q=-1.0 Lsize= 7109kB time=01:37:09.70 bitrate= 10.0kbits/s speed=5.16e+004x video:7043kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.926229%
Any idea what am I doing wrong? The warning seems to hint towards the issue here.
Other possibly useful info:
$ ffprobe -hide_banner blank.mkv Input #0, matroska,webm, from 'blank.mkv': Metadata: ENCODER : Lavf57.83.100 Duration: 00:00:10.00, start: 0.000000, bitrate: 1 kb/s Stream #0:0: Video: vp8, yuv420p(progressive), 320x240, SAR 1:1 DAR 4:3, 1 fps, 1 tbr, 1k tbn, 1k tbc (default) Metadata: ENCODER : Lavc57.107.100 libvpx DURATION : 00:00:10.000000000 $ ffprobe -hide_banner video_example.mkv Input #0, matroska,webm, from 'video_example.mkv': Metadata: encoder : GStreamer matroskamux version 1.8.1.1 creation_time : 2018-05-04T17:57:04.000000Z Duration: 01:37:08.70, start: 15434.269000, bitrate: 9 kb/s Stream #0:0(eng): Video: vp8, yuv420p(progressive), 320x240, SAR 1:1 DAR 4:3, 1 fps, 1 tbr, 1k tbn, 1k tbc (default) Metadata: title : Video $ ffmpeg -v ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.0 (GCC)