Node.js ffmpeg and iPad/iPhone MOV file rotations

This is a fun one. I’ve tried to figure it out, not entirely sure how. :wink:

Problem: When a member uploads an iPad or an iPhone video, and they filmed it up/down not sideways, creating the wrong rotation, ffmpeg seems to rotate it automatically because of the meta data in the MOV file.

Since the meta data in the MOV file is of a fixed rotation, ffmpeg is rotating it when it shouldn’t. This means that when I encode with:

var command = 'ffmpeg -y -i ' + queued_folder + current_file.filename + ' -acodec libfaac -b:a 96k -s 1280x720 -vcodec libx264 -movflags faststart -profile:v baseline -pix_fmt yuv420p -level:v 30 -crf 31 -threads 8 "' + temp_folder + filename + '"';

…the resulting video is flipped into 720x1280, not 1280x720. This causes huge problems on the single media display and makes the video flow half way down the page well into the comments.

It took a while to figure out that the video’s metadata is causing this problem, because the metadata is telling ffmpeg to rotate the video. I cant add a rotation command, because then all videos get rotated and then only iPad/iPhone videos look good and the rest are messed up. :slight_smile:

Here is a StackOverflow article from other people who have had this problem: http://goo.gl/FSrO3b and it also shows some solutions.

The solution would probably come within ffmpeg_server.js in adding a command before the file is encoded to simply strip it of its metadata.

I am HORRIBLE with JavaScript, so here I am asking for help. :slight_smile:

If you need the sample MOV file in order to test this, please let me know how to send the original un-converted video to you. It would not be appropriate to post the video here. :slight_smile:

Thank you!

Ben

Hi @illusionsglass

We will look into this orientation issue. We first need to find appropriate solution for it. Moreover, we are re-factoring the whole media-node in which we are improving video quality and will take care of this issue in new version.

Thanks much. I went with the ffmpeg command as you see above as a result of poor wmv video quality when I initially installed node. mp4’s always encoded with “ok” quality, but man, those wmv’s sure didn’t. :slight_smile:

It’d be handy if there was an option to set as 1920x1080, 1280x720, or some lower resolution to allow webmasters to choose the quality that they would like videos to be served as.

Beyond that, it’s quite the nice addon, and I’m happy you guys wrote it. If you need a beta tester, let me know. :slight_smile:

Ben

Though there are many video rotator which can rotate MOV, it change the video quality.

Luckily, I find iDealshare VideoGo, it can rotate MOV video 90 degrees clockwise, 180 degrees or 270 degrees without changing the video quality.

It support rotate MOV as well as keep the same video format or convert MOV to other video format.

It even can rotate MP4, AVI, MKV, MPG, WMV and etc

@changegrowup I dont think you understand. Thankfully rtCamp does understand, so this post is to help you understand, not them. :slight_smile:

As a site admin, sure, you can rotate your own videos before you upload them. But when your members of your site upload 50 videos a day, you want the software to do this automatically. That’s what the ffmpeg encoder and rtmedia pro handle for me, all automated, and without delay. :wink: You can’t run a tube site optimally by rotating members videos manually for them. You’d go crazy! :slight_smile: :slight_smile: :slight_smile: