Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Displaying a FOURCC UYVY video frame in a C# application
4 avril 2019, par jjdev80I'm getting a byte stream from an encoder device, the byte stream is said to contain a "FOURCC UYVY" image. I need to display that image inside a C# application (Windows Forms), what would be the best way to do that?
I have seen some examples on how it's done using ffmpeg, but it's rather complicated, are there other, more convenient ways to do so?
-
How to keep all parameters of input file while encoding to mxf using ffmpeg ?
4 avril 2019, par superuser123I'd like to encode an mxf file to another mxf file while keeping all parameters for both video and audio. First, tried simple command:
ffmpeg in.mxf out.mxf
But this changed the bitrate of video stream from 25M to 200K and some other parameters. Besides, this removed one audio stream among two of input file.
How can I deep all input parameters and streams of input file?
PS: I cannot use -copy option because I should insert some image processing module while encoding.
Thanks in advance.
-
How to dynamically change the name of the screenshot taken by ffmpeg ?
4 avril 2019, par SchülerHow to change the name of the screenshots each time. here is my code:
ffmpeg(req.file.path) .on('filenames', function(filenames) { console.log('screenshots are ' + filenames.join(', ')); }) .on('end', function() { console.log('screenshots were saved'); }) .on('error', function(err) { console.log('an error happened: ' + err.message); }) // take 1 screenshots at predefined timemarks and size .takeScreenshots({ count: 1, timemarks: [30.5, '50%', '01:10.123'], size: '200x200' }, "Video/");
the above code is generating screenshots of a video but the name of the screenshot will be
tn_1.png
tn_2.png
etc it will replace the images existing images each time how to change the names dynamically? -
It's possible to catch ffmpeg errors with python ?
4 avril 2019, par Elros RomeoHi I'm trying to make a video converter for django with python, I forked django-ffmpeg module which does almost everything I want, except that doesn't catch error if conversion failed.
Basically the module passes to the command line interface the ffmpeg command to make the conversion like this:
/usr/bin/ffmpeg -hide_banner -nostats -i %(input_file)s -target film-dvd %(output_file)
Module uses this method to pass the ffmpeg command to cli and get the output:
def _cli(self, cmd, without_output=False): print 'cli' if os.name == 'posix': import commands return commands.getoutput(cmd) else: import subprocess if without_output: DEVNULL = open(os.devnull, 'wb') subprocess.Popen(cmd, stdout=DEVNULL, stderr=DEVNULL) else: p = subprocess.Popen(cmd, stdout=subprocess.PIPE) return p.stdout.read()
But for example, I you upload an corrupted video file it only returns the ffmpeg message printed on the cli, but nothing is triggered to know that something failed
This is an ffmpeg sample output when conversion failed:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x237d500] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible! [mov,mp4,m4a,3gp,3g2,mj2 @ 0x237d500] moov atom not found /home/user/PycharmProjects/videotest/media/videos/orig/270f412927f3405aba041265725cdf6b.mp4: Invalid data found when processing input
I was wondering if there's any way to make that an exception and how, so I can handle it easy.
The only option that came to my mind is to search: "Invalid data found when processing input" in the cli output message string but I'm not shure that if this is the best approach. Anyone can help me and guide me with this please.
-
Could a compression algorithm be lossless and lossy at the same time ?
4 avril 2019, par Pasta FrescaI have seen ffmpeg has some codecs (e.g. H.264) which are defined as lossless and lossy at the same time, and from my understanding, lossless and lossy are mutually exclusive: a compression algorithm either losses information or doesn't.
How is it possible to be lossless and lossy at the same time?
Running
ffmpeg -codecs 2>/dev/null| grep h264
, I get:DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [...]
DEV.LS
stands for Decoder, Encoder, Video, Not only intraframe compression, Lossy compression, Lossless compression.