View Single Post
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#10
Originally Posted by Android_808 View Post
I must confess, I didn't read the original post, just the title and whatever post was visible when loaded on n900 earlier. endsormeans may have a point, could have been used to advertise a product. I'm gonna have a guess that most of us have ffmpeg on our device from using other packages (cutetube for example).

ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=90 output.mp4

should be all that needed. No transcoding, just copy tracks into new file and add rotation via metadata. Whether it would be played back correctly on our device I can't be bothered to test at the moment.
Tested now on my Jolla and it not rotate video with this command... Here is output:
Code:
[nemo@Jolla Templates]$ ffmpeg_static -i /media/sdcard/3F0A-A187/VideoSD/test_rotation.mp4 -c copy -metadata:s:v:0 rotate=90 /media/sdcard/3F0A-A187/VideoSD/test_rotation2.mp4
ffmpeg version 2.1.4-static Copyright (c) 2000-2014 the FFmpeg developers
  built on May 29 2014 14:58:09 with gcc 4.6.4 (Linaro GCC 4.6-2013.05) 20130412 (Mer 4.6.4-1)
  configuration: --prefix=/home/mersdk/share/ffmpeg-static/target --extra-cflags='-I/home/mersdk/share/ffmpeg-static/target/include -static' --extra-ldflags='-L/home/mersdk/share/ffmpeg-static/target/lib -static' --extra-version=static --disable-debug --disable-shared --enable-static --extra-cflags=--static --disable-ffplay --disable-ffserver --disable-doc --enable-gpl --enable-pthreads --enable-postproc --enable-gray --enable-runtime-cpudetect --enable-libfaac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-bzlib --enable-zlib --enable-nonfree --enable-version3 --enable-libvpx --disable-devices
  libavutil      52. 48.101 / 52. 48.101
  libavcodec     55. 39.101 / 55. 39.101
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/sdcard/3F0A-A187/VideoSD/test_rotation.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2014-07-24 18:10:30
  Duration: 00:00:34.77, start: 0.000000, bitrate: 7188 kb/s
    Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 1920x1088 [SAR 1:1 DAR 30:17], 7080 kb/s, 16.70 fps, 16.67 tbr, 3k tbn, 60 tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2014-07-24 18:10:30
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 135 kb/s (default)
    Metadata:
      creation_time   : 2014-07-24 18:10:30
      handler_name    : SoundHandler
[mp4 @ 0x2550660] track 1: codec frame size is not set
Output #0, mp4, to '/media/sdcard/3F0A-A187/VideoSD/test_rotation2.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    encoder         : Lavf55.19.104
    Stream #0:0(eng): Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 1920x1088 [SAR 1:1 DAR 30:17], q=2-31, 7080 kb/s, 16.70 fps, 12k tbn, 3k tbc (default)
    Metadata:
      handler_name    : VideoHandler
      creation_time   : 2014-07-24 18:10:30
      rotate          : 90
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 135 kb/s (default)
    Metadata:
      creation_time   : 2014-07-24 18:10:30
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  578 fps=169 q=-1.0 Lsize=   30512kB time=00:00:34.75 bitrate=7192.5kbits/s
video:29914kB audio:577kB subtitle:0 global headers:0kB muxing overhead 0.069780%
[nemo@Jolla Templates]$
But new created file with a little different file size 30,512 KiB (orig: 30,514 KiB)

EDIT:
Found how to rotate.. But it need to reencode your video and it take too much time
For example rotate video of 35sec takes ~20min
Used this command:
Code:
ffmpeg_static -i /path/to/input.mp4 -vf "transpose=1" -c:a copy /path/to/output.mp4
For the transpose parameter you can pass:
Code:
0 = 90CounterCLockwise and Vertical Flip (default)
1 = 90Clockwise
2 = 90CounterClockwise
3 = 90Clockwise and Vertical Flip
To get ffmpeg_static, install this package: https://openrepos.net/content/darvari/ffmpegstatic

Last edited by Schturman; 2014-10-12 at 05:47.
 

The Following 4 Users Say Thank You to Schturman For This Useful Post: