Motion Vector extraction from encoded video file - ffmpeg

I am trying to extract motion vector data from an encoded mp4 file. In a previous post I found
an answer http://www.princeton.edu/~jiasic/cos435/motion_vector.c . But I am not able to run the code without errors . What are the other files that have to be included in the file ? I am a newbie here . So any help would be appreciated .

I had modified the source code of mplayer (ffmpeg) to extract motion vectors for any compressed video, I have uploaded the modified mplayer code which can be used for extracting motion vectors here http://www.cs.umd.edu/~bharat/modmplayer.zip
You need to do the following to extract motion vectors if you use the modified version of mplayer
./mplayer -nosound -fps 200 -vo null -lavdopts vismv=1 path_of_video_file 2> path_of_output_file.txt
Pre-compiled executable and some useful files are available in the outputs folder

Related

Script to bulk merge audio and a video+audio file

I have a folder with 52 video+audio files (m3u8 extn)
and 52 audio files (different language)(m4a extn)
The names of the files are same
abcde.m3u8(video)
abcde.m4a(that other language audio only file)
i want to merge them so i have a single file Video+auido1+audio2
and i don't to lose any quality in the merging process
What would be the bash/ffmpeg command to do so?
Thanks a lot
Something like :
for f in *.m3u8
do
basename="${f%.*}"
ffmpeg -i "${basename}.m3u8" -i "${basename}.m4a" -c copy "${basename}.mkv"
done
Are you sure the m3u8 files contain actual video frames?

Using wildcards with "convert". Or "convert"ing a group of files

I regularly scan in my Homework for class. My scanner exports raw jpg files to usb, and from there I can use gimp to edit and save the files as a pdf. One time saver I've found is to export my multi-page homeworks as a .mng file and then use the convert function to turn it into a pdf. I do it this way because Gimp automatically merges all layers when exporting to a pdf.
convert HW.mng HW.pdf
this works well for individual files, but at the end of every week I can have dozens of files to convert.
I have tried using wildcards in the filenames for convert:
convert *.mng *.pdf
This always runs successfully and never throws an error, but never produces any pdfs.
Both
convert HW*.mng HW*.pdf
and
convert "HW*.mng" "HW*.pdf"
yeild the error
convert: unable to open image `HW*.pdf': Invalid argument # error/blob.c/OpenBlob/2712.
which I think means the error lies in exporting with a wildcard.
Is there any way to convert all of a specific file type to another using convert? Or should I try using a different program?
You can see this StackExchange post. The accepted answer basically does what you want.
for file in *.mng; do convert -input "$file" -output "${file/%mng/pdf}"; done
For convert in particular, use mogrify (which is part of ImageMagick as well) as suggested by Mark Setchell in a comment. mogrify can be used to edit/convert files in batches. The command for your case would be
mogrify -format pdf -- *.mng

Any working example recording a (e.g. rtsp) stream to a local MP4 file with ffmpeg/libav?

I'm looking for a working and not-out-dated script how to record an e.g. rtsp input stream to a local file (mp4) with ffmpeg/libav. If you could point me to one or post one, many thanks in advance. I'm searching for many hours and I haven't got any experience with this topic.
A lot of examples, libs, etc. are outdated, but I want to use ffmpeg >= v3.3.
Any special things I have to consider (when compiling ffmpeg, or when saving local file to iOS device)?
Ffmpeg syntax is very straight forward.
ffmpeg [global_options] {[input_file_options] -i input_url} ... {[output_file_options] output_url} ...
So, if you donĀ“t need to reencode or decode your RTPS video stream, you can simply run:
ffmpeg -i rtsp://your_stream_url your_file_name.format
Where format could be avi, mp4, flv or others, ffmpeg you automatic package your stream to the output file.
More information here.
https://www.ffmpeg.org/ffmpeg.html
Any special things I have to consider (when compiling ffmpeg, or when
saving local file to iOS device)?
Do you need to compile ffmpeg for an specific reason? I belive libav is enable on the executable you could download from the site.

Getting exact time-stamp appended to the file from ffmpeg process

I am trying to capture frames using ffmpeg from a stream of video , which i am saving locally to my folder,
I need to know the exact time-stamp at which the frame is being captured
what i have tried so far is :
ffmpeg -i rtsp://ipaddress/axis-media/media.amp?camera=1 -an -vf showinfo %10d.jpg 2> res.txt
which i got from the source :
get-each-frame-time-stamp
this works fine too, the res.txt contains the time-elapsed of each frame since ffmpeg started(if my understanding is not wrong) ,
What i need is to get this time appended to the image files names which are being created or some other ways so that time-stamp information could be stored within the image.
any kind of help would be really appreciated .

ImageMagick Warning (TIF Conversion)

When I convert a Multi-Image TIF File to Individual TIF Files using ImageMagick I'm getting a Warning stating "Invalid TIFF Directory; tags are not sorted in ascending order'.
convert.exe: Invalid TIFF directory; tags are not sorted in ascending order.
'TIFFReadDirectoryCheckorder' # warning/tiff.c/TIFFWarnings/847
Hoping for Any advice I can get on this error. I am trying to take a Multi-Image TIF File and Turn it into Individual Files, however I need them to be in the order in which they were listed in the Original TIF File for this to work.
If you still have the issue check the limitation disk:
convert -list resource
Example for debian 9 /etc/ImageMagick-6/policy.xml.
I hope that could be helpful.

Resources