Guys--I've been out of the technical game for a while (my last post was over 15 years ago and it reads like a different language!) so forgive me if my question is a little basic.
I have a Motion JPEG .avi file that is 7min and 52sec (472 sec) long that I want to rotate as losslessly as possible. Windows 10 Explorer as well as VLC both tell me that the frame rate for this video is 30fps.
So using ffmpeg, I found this line of code to extract the jpgs from the mjpg in my avi, so I that can rotate them manually:
This produced 10,574 jpgs which translates to about 22.4 frames per second (10574 frames / 472 sec). There is a clock baked into the video as well--not sure if it's precise enough to use as timecode, but eyeballing it confirms that it is indeed 22-23 frames per second.Code:ffmpeg -i mjpegvideo.avi -vcodec copy frame%d.jpg
I haven't gone any further yet, but I imagine that when I put the jpgs together, I'll have to specify a frame rate. But if I put 30 fps, then my video will be played too fast, no?
Hoping you guys can explain what's going on to this ol' geezer newbie.
-R
+ Reply to Thread
Results 1 to 5 of 5
-
-
If possible please add 'vsync 0' and perhaps 'mjpeg2jpeg' bitstream filter - it could be useful if you activate 'report' functionality and provide log if possible.
Code:ffmpeg -report -i mjpegvideo.avi -c:v copy -bsf:v mjpeg2jpeg -vsync 0 frame%d.jpg
-
Maybe the video in your AVI is shorter than the audio? Ie, 472 seconds of audio but only ~352 seconds of video.
If you can live with a mov file try a simple remux (no loss of quality) with rotation flag.
Code:ffmpeg -i mjpeg.avi -c copy -metadata:s:v:0 rotate=90 mjpeg.mov
-
Got tied up with work and wasn't able to work on your suggestions until now, but thanks for getting back to me so quickly, guys!
Done and attached. I can't really make heads or tails of the log, but you'll see that the video is 7min 52.23sec long @30fps but only 10,574 frames are produced.
Nope. Audio starts and stops with video.
Thanks for the tip! I'm not a huge fan of .mov files but this worked (tried replacing the '.mov' extension with '.avi' but that didn't work). Only thing is that part way through the original clip, the camera rotates to the correct orientation, so I thought by extracting the jpgs from the Motion JPEG that I could just rotate the frames that needed it. To really address this, I'd need a lossless way to split either the .avi or the .mov, and then concatenate it back again.
In any case, thanks again. And standing by for whatever you guys can tell me about the attached log file. -
Mjpeg is an intra frame codec so you can split the video losslessly. Then rotate only the section that needs rotation. You might be able to avoid any reencoding by setting the mp4/mov rotation flag and have it retained when you join the sections back together again. Even if you do manage that not all players will play it properly though.
Code:ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=90 output.mp4
Last edited by jagabo; 4th May 2022 at 11:42.
Similar Threads
-
Restore 30fps out of 25 with deleted frames
By embis2003 in forum RestorationReplies: 16Last Post: 28th Mar 2021, 07:24 -
Unable to extract LPCM audio from MJPG video stream
By JJonah in forum AudioReplies: 4Last Post: 6th Feb 2020, 05:45 -
ffmpeg: make one mp4 out of several dirs of jpgs? [SOLVED]
By quixote7 in forum Newbie / General discussionsReplies: 2Last Post: 18th Dec 2018, 16:24 -
How to convert a video from 30fps to 60fps by FFmpeg ?
By kwanami in forum Video ConversionReplies: 8Last Post: 3rd May 2018, 22:58 -
Can I force ffmpeg to transcode 59.94 frames to display at 25 frames per se
By oduodui in forum EditingReplies: 4Last Post: 28th Apr 2018, 09:24