Anyone know if ffprobe is safe to use as a method to check the content of a video? I want to determine if someone renames an exe to mp4 or some other video mime and I run ffprobe on it, would the file execute or fail safely without executing the content?
ffprobe should not execute content unless DirectDraw filter would do it itself (which is rather weird thing to think of).
Yet, AFAIK, ffprobe doesnt't produce nice MIME information, especially for not-multimedia-files. format_name/format_long_name are not very good.
For what you're looking for, the best approach is content sniffing described at https://mimesniff.spec.whatwg.org/
I have found that link in this SO question: MIME type for transcoded stream
Related
I want to get the mime type (e.g. video/mp4) of a media file using ffprobe. Is that possible or do I need another program for that?
The file command may be able to get you what you want. It even has a --mime-type flag you can set to pull that data out specifically.
I have just found out, while working on another project, if you do ffmpeg -h muxer=mp4, it also shows the mime type. This has made it a lot easier for me. I can run ffprobe testvid.mp4, find the file type and then use the -h muxer= method to get the mime type.
As you can see the in the above image, the end part of the .wav file is not represented in the mp3 file. Here, I am making use of avcodec_decode_audio4() api to decode each packet, and using lame_encode_buffer() api to encode it in mp3 format. Here, I am seeing this issue for MONO streams( 1.wav -> 1.mp3 ). I just wanted to know why is this occuring, even when I am providing all the .wav file content. I am suspecting there is some caching that is happening, due to which I am unable to get whole data into the mp3 file. Any help here would be appreciated.
Add a section of silence at the end of the WAV file then reconvert to mp3
I'm trying to port FFmpeg into my NaCl module.
So far, my module linked ffmpeg and SDL libraries.
It already can play YUV format video which is directed load into memory and copy into YUVOverlay buffer (it's very easy).
Now, I want to use ffmpeg to decode video, but when I call the function avformat_open_input it returns -5 when input is URL string, such as rtmp:// or mmsh://; it returns -1052488119 when input is file name, such as /saved/tmp (I mount the file system - html5fs).
There are some questions:
What means of -5 and -1052488119?
If file can't open by avformat_open_input, is it possible the input type is from buffer not from file name or url string?
If I'm not clearly about my question or description, you can tell me.
If you are doing the same thing or having the same problem, we can discuss together.
Thanks,
Jar
There is a ffmpeg port in naclports. Maybe that would be useful for you?
you can find naclports at https://chromium.googlesource.com/webports/. They were moved from http://code.google.com/p/naclports/.
The word file here refers to the shell file command, and not actual files. I want to determine whether a file is a, for example, video file (.mpg, .mkv, .avi). file is pretty good at returning image for image files, video for video files, and audio for audio files (and application/x-empty for some reason for text). My question is how reliable this is for identifying types. If I did a simple
file -ib deliverance.avi | grep video
would that work for all of the main video files outlined here?
The results from file are less than perfect, and it has more problems with some types of files than others. File basically just looks for particular pieces of binary data in predictable patterns to figure out filetypes.
Unfortunately, in particular, some of the filetypes often used for video fall into this "problematic" category. The newer container formats like .mp4 and .mkv usually have several different MIME types that should properly depend on what type of data is being contained. For example, an .mp4 could properly be identified as video/mp4, audio/mp4, or application/mp4 depending on the content.
In practice, file often makes guesses that simply conform with common usage, and it may work perfectly well for you. For example, while I mentioned some theoretical difficulties with identifying Matroska files correctly, file basically just assumes that any Matroska file is a video. On the other hand, the usage of the Ogg container is more evenly split between audio and video, and I believe the current version of file just splits the difference, and identifies Ogg files as application/ogg, which wouldn't fall into any of your categories.
The one thing I can say with certainty is that you want the most up-to-date version of file you can get your hands on. The "magic" files that contain the patterns to match against and the MIME types that will result from a match are updated fairly often to include newer filetypes like WebM, or just to improve accuracy for older types.
file works by referencing the header of the file against a "magic number" file. I suspect the best way to see how robust file is to check your local magic number file (possibly /usr/share/magic but see man file for details) for the file types from your referenced list.
It seems like it should work for most video/audio/image files. But, if it doesn't, there's actually a file that contains the relations between an extension and it's type:
The information identifying these files is read from the compiled magic file /usr/share/magic.mgc , or /usr/share/magic if the compile file does not exist.
see:
http://linux.about.com/library/cmd/blcmdl1_file.htm
Hope this helps!
Where can I find documentation/sample code of the VOBsub subtitles format? The one that's an .idx and a .sub file.
I need to create a program that generates those subtitles. I've been looking on Google but only found how to rip them from DVD.
Thanks
VOBsub extracts the DVD subtitles raw PES from a DVD and dumps this to a .sub file. It also creates a .idx Index file with the times and byteoffsets for each and every single subtitle. The format has support for multiple tracks and can also be embedded in MP4 (by Nero) and Matroska files.
Technical specs vobsub
Technical specs from Matroska.org
Example files: Specs_and_idx-sub_files.rar
Have a look at these open source implementations:
BDSup2Sub (Java)
Subtitle Edit (C#)
guliverkli by gabest (C++) check out VSFilter and VSRip; original implementation
Son2VobSub.rar (C++)
And then there are the media players like VLC. You can also check out these threads on doom9:
http://forum.doom9.org/archive/index.php/t-87171.html
http://forum.doom9.org/archive/index.php/t-99815.html
I think your best approach would be to have a look at the sourcecode of some of the open-source media players. Some of them will have the code to interpret an .idx or .sub subtitle file.
This might be a useful starting point:
http://sourceforge.net/projects/guliverkli/