Getting all possible video file data using mediainfo in linux ( using C ) - c

I need to extract all meta data along with play-length information from the video files in pure C .
I goggled and found MediaInfo Library but was not able to find any relevant c sample code .
Is there any other way to achieve this with / without MetaInfo ?
Or can somebody point me to a good sample code of MediaInfo in C

ffprobe which is part of ffmpeg can do a whole lot more.
ffprobe without switches will give some common information
It also has lot of switches of which you can use one at a time [exclusively]
-show_format show format/container info
-show_streams show streams info
-show_packets show packets info
-show_frames show frames info
-show_data show packets data
Try it out.

Related

Playing a Frequency in OpenAL in C

I am trying to write a program to play a frequency for a time. I can't find any way of simply just playing a certain frequency. How do I go about doing this in OpenAL?
I eventually found a video on properly reading form a WAV file (huge credit to this video) and how a WAV file is formatted (explained here in detail) and did some trial-and-error work until I figured out how to do it. I figured that if I could make a WAV-style file with the frequencies in them and set up the OpenAL buffer and source manually, it would work.
I ran into some trouble when I found that the format differed from the first explanation of WAV file format I found, as some apparently have additional meta-data, which I had to test for and skip over when trying to load a WAV file. Then I made a WAV file containing the frequencies and played it, which worked as well as I could have hoped for.
Here's another article about how bit-depth works that really helped me understand what I was doing.
Hopefully this helps anyone else who is trying to do something similar to this!

AVDictionary set recorded file from stream metadata so video player does not think it is a stream

I'm currently recording an RTSP stream using the FFMPEG libaries (essentially recording in 1 minute video files). Everything is working well, with the exception that if I launch the video files, the player views them as streams, not as videos (so seeking is disabled, etc.).
I suspect I need to set the proper option when I am using avformat_write_header(output_context, NULL) instead of giving no options.
I've discovered the list of options in libavformat/options_table.h but none of them seem to apply. As an example of how I'm thinking I need to solve this, I've looked at https://ffmpeg.org/pipermail/libav-user/2013-January/003541.html and I see things like "sample_rate", "pixel_format" etc. that could be set. Is there something to set the metadata in the file I'm writing from an RTSP stream to behave as a video instead of a stream when I play it after the fact? Or if it isn't written with the header, is there some other way I can do this?
Seems like the issue is related to the specific video player being used, which makes me believe its not related to the meta data but how the player is interpreting the video stream.
If it does turn out that I can explicitly set this using the FFMPEG libraries I'll mark that as the accepted answer.

How do you parse JSON Data in Arduino

I want to parse JSON data from a File in Arduino, how can I do this, I am using Arduino Yun.
One other way I was wondering was to run shell script to take unnecessary data out of the file and leave the data that was necessary for parsing with comma separated but some how when I run this command :
Serial.println(p.runShellCommand("more /mnt/sda1/json.txt |grep -o \"[^ ]*$ " ));
I don't seem to get output at the serial Monitor and i'm not able to save the content in a variable.
Please help out with this issue.
C doesn't have built in JSON parsing capability. Your options are to use something like Jsmn, or aJson (arduino JSON) or have your data provider give it to you in a different format if possible.

Re-encode with ffmpeg

I am trying to do following work in C code with the help of ffmpeg library
Decode a mp2 audio file.
Write decoded data to a file named test.sw
Read data from test.sw and re-encode it to mp2 audio file.
For 1 and 2, i followed example given in decoding_encoding.c which is working fine. While reading and re-encoding, i can't understand how to read from test.sw file and encode it. Can anybody help me with that? It will help me a lot if anybody can provide me any tutorial regarding this topic.
As I understood your question you want to encode to mp2 format.I suggest to use the encoding technique used for mp2 format and use the library ,You have one library ffmpeg just check is it having for encoding .If yes then just use that function and pass your decoded file.
You can check it
http://ffmpeg.org/doxygen/trunk/encoding-example_8c-source.html

Passing a URL to a specific piece of example code which extracts samples from a WAV file

I don't know if it is legal on SOF to access such a specific question, but here I go:
I've found this wonderful piece of code which takes all the samples from a WAV file and passes it into an array.
The code compiles, but I can't seem to figure out where to pass the argument of where the file is and what its name is.
Any help?
PS If this code does what it says it does, I think it could be useful to a lot of people.
Thanks!
If you look at the code it's reading from stdin (and it even says in the description above the code: "It reads from stdin"). Evidently it's designed to be used as a command line tool (or "filter") which can be piped with other tools, or standalone using I/O redirection.
You should be able to pipe output from wget or curl.
wget -O - http://www.whatever.com/somefile.wav | yourpieceofcode

Resources