How to add telemetry data from a video to jpg file? - ffmpeg

I have a 360deg video that is created by Go Pro Fusion and has telemetry data in it. I want to extract the telemetry data and put inside of jpg file.
I am extracting images using ffmpeg:
ffmpeg -i VIDEO.mp4 -r 5 img%d.jpg
How can i extract metadata(including telemetry data) for each frame and put that metadata inside jpg image of that frame.
I tried using
exiftool -ee -a -u -U -TagsFromFile video.mp4 img1.jpg
But all the metadata that appear in video does not appear in image.
I tried this:
exiftool -track1:VideoFrameRate=29.97 img1.jpg
But getting this warning:
Warning: Sorry, Track1:VideoFrameRate doesn't exist or isn't writable
Nothing to do.
<Track1:VideoFrameRate>20.00</Track1:VideoFrameRate>
I get this from video. But unable to set in jpg as mentioned above.
And how to ensure that the images are assigned with the exact GPS data?

Related

How to compress gif effectively to reduce size?

We use gifs for our blog extensively. We used to embed tenor nano gifs(90px height maintaining aspect ratio, used for GIF previews and shares on mobile) in it. Now we wanted to create our own gifs and are using the following command to convert mp4 to gif while maintaining the properties of tenor's nano gif. using ffmpeg version 4.1.4
But we observed a huge difference in size between the gif we created and the one created using tenor.
ffmpeg -i input.mp4 -filter_complex "[0:v]fps=10,scale=-1:90:flags=lanczos,split [a][b];[a] palettegen [p];[b][p] paletteuse" -y output.gif
[Original MP4] - 845KB
Tenor Nano gif - 42KB
ffmpeg gif - 106KB
We even tried changing dithering algorithm to further reduce size but it ended up adding noise and damaged the gif quality
paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle
We tried tweaking colour quantization in gifsicle as well but it was of no use.
gifsicle --resize _x90 --colors 256 --color-method diversity --dither=ordered --resize-method sample input.gif > output.gif
What worked for me was specifying a lower frame rate (-r 10) for the output gif. Probably not what you want if you're after quality but if you're after quality file size may be the compromise.
Try this bat file. I wrote it for myself. I have Windows os.
It converts FFmpeg mp4 to gif
Create two packages Your_files and Result put the bat file next to the folders.
Put these folders and baht file next to ffmpeg.exe
Drag your files (file) to the Your_files folder
Run bat file
We take the finished files from the Result folder
color a
#echo off
set a="Your_files\*.mp4"
set b="Result\%%~na.gif"
set c=ffmpeg
set f=-filter_complex "[0:v] fps=10,scale=-1:-1:flags=full_chroma_int,split [a][b];[a] palettegen=max_colors=255:reserve_transparent=1:stats_mode=diff [p];[b][p] paletteuse=dither=none:bayer_scale=5:diff_mode=rectangle:new=1:alpha_threshold=128" -gifflags -offsetting
for %%a in (%a%) do (%c% -y -i "%%a" %f% %b%)
If it crashes, remove these lines: -gifflags -offsetting

FFmpeg record rtsp stream to file error

I use ffmpeg to record rtsp stream, it work good but the output file got some proble, when I use use K-Lite Codec Pack to open the output (avi) file the video cant be seek, forward, backward and dont display video time. It lock like i am viewing streaming.
here is the command i used
ffmpeg -i rtsp://27.74.xxx.xxx:55/ufirststream -acodec copy -vcodec copy abc.avi
video playing error with K-Lite Codec Park image
Looks like header file not been updated on output file. It's recommended to close output file by pressing "q" button while ffmpeg reads input stream to properly finalize output file.

Transfer custom (all) metadata using ffmpeg

How to transfer metadata using FFMPEG or other tools with CMD ?
I'm trying to encode video/audio and since they already have metadata inside obviously i want to preserve them into my new file
btw since i'm using mediamonkey as main player, there's also some Custom metadata. this is the one who wont transfer
for Video output file using mp4/mkv (using x264)
for Audio output file using m4a (using neroAac)
Thank You!
ps. which container is best for neroAac and x264? since i can't seem to edit mkv metadata (when i remove from mediamonkey playlist, they're all gone), mp4 is fine though and i can't seem to play AAC, although it's fine when muxed into video
Copy all custom and global metadata tag information using the following command:
ffmpeg <inputfile> -movflags use_metadata_tags -c copy <outputfile>

jpg won't optimize (jpegtran, jpegoptim)

I have an image and it's a jpg.
I tried running through jpegtran with the following command:
$ jpegtran -copy none -optimize image.jpg > out.jpg
The file outputs, but the image seems un-modified (no size change)
I tried jpegoptim:
$ jpegoptim image.jpg
image.jpg 4475x2984 24bit P JFIF [OK] 1679488 --> 1679488 bytes (0.00%), skipped.
I get the same results when I use --force with jpegoptim except it reports that it's optimized but there is no change in file size
Here is the image in question: http://i.imgur.com/NAuigj0.jpg
But I can't seem to get it to work with any other jpegs I have either (only tried a couple though).
Am I doing something wrong?
I downloaded your image from imgur, but the size is 189,056 bytes. Is it possible that imgur did something to your image?
Anyway, I managed to optimize it to 165,920 bytes using Leanify (I'm the author) and it's lossless.

Copying timecode into output file ffmpeg or ffmbc

I have media files in various formats that I want to be able to segment using ffmbc, same acodec, vcodec and container as original. I would like to be able to maintain the timecode data e.g. start_delay, from the original to destination media files ( with the segmented offset taken into account ).
At the moment when I copy using the command -i inputfile.mxf -vcodec copy -avodec copy outputfile.mxf ( segmenting options omitted ) the output file start timecode is set to 00:00:00.
The original files are mainly in .mxf and .mov container formats.
Is there a command for this that I am missing?
My bad, I clearly did not try the obvious. The command for setting the start timecode is: -timecode HH:MM:SS:FF

Resources