Re: [gentoo-user] Re: off topic: rotating a video

2015-02-18 Thread gottlieb
On Mon, Feb 16 2015, David Haller wrote:

 Hello,

 On Mon, 16 Feb 2015, gottl...@nyu.edu wrote:
I built and tried mplayer.  Again not rotated.  I ran it from the
terminal.  Below is the output up to when I killed it
 [..]
VO: [xv] 1920x1080 = 1920x1080 Planar YV12 

 FWIW: if it's just for watching the vid, try

 mplayer -vf rotate=1 foo.mp4

 That's rotating 90deg clockwise, see 'man mplayer', search for
 'rotate', second hit:

 [..]
 -vf
 [..]
rotate[=0-7]
   Rotates  the  image  by 90 degrees and optionally flips it.  For
   values between 4-7 rotation is only done if the  movie  geometry
   is portrait and not landscape.

  0Rotate by 90 degrees clockwise and flip (default).
  1Rotate by 90 degrees clockwise.
  2Rotate by 90 degrees counterclockwise.
  3Rotate by 90 degrees counterclockwise and flip.

 When using '-ovc copy', mencoder does not (as usual) seem to apply
 this filter.

 HTH,
 -dnh

This worked (as did -flip for 180 degrees)!

Thanks to everyone for their help.

allan



[gentoo-user] Re: off topic: rotating a video

2015-02-16 Thread Nikos Chantziaras

On 16/02/15 22:51, gottl...@nyu.edu wrote:

I apologize in advance for this off topic query.

I took a video with my phone (galaxy note 4) and via google+ uploaded it
to my mail laptop.  It is an mp4 and plays fine on both the phone and
the labtop except that it is sideways.

I was surprised that neither the player on the phone nor the player on
the laptop (totem, I run gnome) seems to offer a rotation option.

Am I missing a slightly hidden option or do I need another program.
I do not do video editing and do no plan to in the near future.


You can change the metadata of the mp4 file without re-encoding it. This 
requires that the player you play the video in actually respects that 
metadata though! mplayer and mpv respect it. Your phone's player might not.


You need ffmpeg for this (media-video/ffmpeg).

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

This tells media players to rotate the video 90 degrees clockwise. If 
you want to rotate 90 degrees counter-clockwise, use rotate=270 instead.


I don't know what the command is if you're using libav instead, but I 
suspect it has to be something similar.





Re: [gentoo-user] Re: off topic: rotating a video

2015-02-16 Thread gottlieb
On Mon, Feb 16 2015, Nikos Chantziaras wrote:

 On 17/02/15 01:39, gottl...@nyu.edu wrote:
 On Mon, Feb 16 2015, Nikos Chantziaras wrote:

 On 16/02/15 22:51, gottl...@nyu.edu wrote:
 I apologize in advance for this off topic query.

 I took a video with my phone (galaxy note 4) and via google+ uploaded it
 to my mail laptop.  It is an mp4 and plays fine on both the phone and
 the labtop except that it is sideways.

 I was surprised that neither the player on the phone nor the player on
 the laptop (totem, I run gnome) seems to offer a rotation option.

 Am I missing a slightly hidden option or do I need another program.
 I do not do video editing and do no plan to in the near future.

 You can change the metadata of the mp4 file without re-encoding
 it. This requires that the player you play the video in actually
 respects that metadata though! mplayer and mpv respect it. Your
 phone's player might not.

 Not worried about the phone.  I won't touch the file there and will
 probably delete it when I get the one right on the laptop.

 You need ffmpeg for this (media-video/ffmpeg).

 That I have (1.2.6-r1, highest stable).

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

 I did this command but the result is not rotated (my player is totem).

 Try mpv or mplayer. If that shows it rotated, then it's totem ignoring
 the metadata.

I built and tried mplayer.  Again not rotated.  I ran it from the
terminal.  Below is the output up to when I killed it

Is it possible I did the ffmpeg command wrong?

thanks,
allan

newlap tmp # mplayer r90.mp4 
MPlayer SVN-r36370 (Gentoo)-4.8.3 (C) 2000-2013 MPlayer Team
MMX2 supported but disabled

Playing r90.mp4.
libavformat version 54.63.104 (external)
libavformat file format detected.
[h264 @ 0x7ff80716e920]Warning: not compiled with thread support, using thread 
emulation
[aac @ 0x7ff80716e920]Warning: not compiled with thread support, using thread 
emulation
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang eng
VIDEO:  [H264]  1920x1080  24bpp  29.917 fps  16996.4 kbps (2074.8 kbyte/s)
Clip info:
 major_brand: isom
 minor_version: 512
 compatible_brands: isomiso2avc1mp41
 encoder: Lavf54.63.104
Load subtitles in ./
==
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.92.100 (external)
[h264 @ 0x7ff80716e920]Warning: not compiled with thread support, using thread 
emulation
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==
==
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
[aac @ 0x7ff80716e920]Warning: not compiled with thread support, using thread 
emulation
AUDIO: 48000 Hz, 2 ch, floatle, 250.1 kbit/8.14% (ratio: 31257-384000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 1920x1080 = 1920x1080 Planar YV12 
A:   7.3 V:   7.3 A-V:  0.000 ct:  0.033   0/  0 70%  1%  0.6% 0 0 

Exiting... (Quit)
newlap tmp # 




[gentoo-user] Re: off topic: rotating a video

2015-02-16 Thread Nikos Chantziaras

On 17/02/15 01:39, gottl...@nyu.edu wrote:

On Mon, Feb 16 2015, Nikos Chantziaras wrote:


On 16/02/15 22:51, gottl...@nyu.edu wrote:

I apologize in advance for this off topic query.

I took a video with my phone (galaxy note 4) and via google+ uploaded it
to my mail laptop.  It is an mp4 and plays fine on both the phone and
the labtop except that it is sideways.

I was surprised that neither the player on the phone nor the player on
the laptop (totem, I run gnome) seems to offer a rotation option.

Am I missing a slightly hidden option or do I need another program.
I do not do video editing and do no plan to in the near future.


You can change the metadata of the mp4 file without re-encoding
it. This requires that the player you play the video in actually
respects that metadata though! mplayer and mpv respect it. Your
phone's player might not.


Not worried about the phone.  I won't touch the file there and will
probably delete it when I get the one right on the laptop.


You need ffmpeg for this (media-video/ffmpeg).


That I have (1.2.6-r1, highest stable).


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


I did this command but the result is not rotated (my player is totem).


Try mpv or mplayer. If that shows it rotated, then it's totem ignoring 
the metadata.





Re: [gentoo-user] Re: off topic: rotating a video

2015-02-16 Thread gottlieb
On Mon, Feb 16 2015, Nikos Chantziaras wrote:

 On 16/02/15 22:51, gottl...@nyu.edu wrote:
 I apologize in advance for this off topic query.

 I took a video with my phone (galaxy note 4) and via google+ uploaded it
 to my mail laptop.  It is an mp4 and plays fine on both the phone and
 the labtop except that it is sideways.

 I was surprised that neither the player on the phone nor the player on
 the laptop (totem, I run gnome) seems to offer a rotation option.

 Am I missing a slightly hidden option or do I need another program.
 I do not do video editing and do no plan to in the near future.

 You can change the metadata of the mp4 file without re-encoding
 it. This requires that the player you play the video in actually
 respects that metadata though! mplayer and mpv respect it. Your
 phone's player might not.

Not worried about the phone.  I won't touch the file there and will
probably delete it when I get the one right on the laptop.

 You need ffmpeg for this (media-video/ffmpeg).

That I have (1.2.6-r1, highest stable).

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

I did this command but the result is not rotated (my player is totem).
There was a warning issued.  Below is the command I used and the
on-screen output.  The resulting mp4 file plays fine but is not rotated.

What did I do wrong?

thanks again,
allan




newlap tmp # ffmpeg -i orig.mp4 -c copy -metadata:s:v:0 rotate=90 r90.mp4
ffmpeg version 1.2.6 Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb  3 2015 14:21:53 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 
--mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc 
--cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar 
--optflags='-march=native -O2 -pipe' --extra-cflags='-march=native -O2 -pipe' 
--extra-cxxflags='-march=native -O2 -pipe' --disable-static --enable-gpl 
--enable-postproc --enable-avfilter --enable-avresample --disable-stripping 
--enable-version3 --disable-indev=v4l2 --disable-indev=oss --disable-indev=jack 
--disable-outdev=oss --enable-bzlib --disable-runtime-cpudetect --disable-debug 
--disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv 
--enable-network --disable-openssl --enable-ffplay --disable-vaapi 
--disable-vdpau --enable-zlib --enable-libvo-aacenc --disable-libvo-amrwbenc 
--enable-libmp3lame --disable-libfdk-aac --disable-libaacplus --disable-libfaac 
--disable-libtheora --disable-libtwolame --enable-libx264 --enable-libxvid 
--disable-libcdio --disable-libiec61883 --disable-libdc1394 --dis  libavutil
  52. 18.100 / 52. 18.100
  libavcodec 54. 92.100 / 54. 92.100
  libavformat54. 63.104 / 54. 63.104
  libavdevice54.  3.103 / 54.  3.103
  libavfilter 3. 42.103 /  3. 42.103
  libswscale  2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc52.  2.100 / 52.  2.100
[h264 @ 0x122e340] Warning: not compiled with thread support, using thread 
emulation
[aac @ 0x122f070] Warning: not compiled with thread support, using thread 
emulation
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'orig.mp4':
  Metadata:
major_brand : isom
minor_version   : 0
compatible_brands: isom3gp4
creation_time   : 2015-02-08 21:30:20
  Duration: 00:05:44.94, start: 0.00, bitrate: 17240 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
1920x1080, 16996 kb/s, 29.91 fps, 29.92 tbr, 90k tbn, 180k tbc
Metadata:
  rotate  : 90
  creation_time   : 2015-02-08 21:30:20
  handler_name: VideoHandle
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 
250 kb/s
Metadata:
  creation_time   : 2015-02-08 21:30:20
  handler_name: SoundHandle
Output #0, mp4, to 'r90.mp4':
  Metadata:
major_brand : isom
minor_version   : 0
compatible_brands: isom3gp4
encoder : Lavf54.63.104
Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, 
q=2-31, 16996 kb/s, 29.91 fps, 90k tbn, 90k tbc
Metadata:
  handler_name: VideoHandle
  creation_time   : 2015-02-08 21:30:20
  rotate  : 90
Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 
250 kb/s
Metadata:
  creation_time   : 2015-02-08 21:30:20
  handler_name: SoundHandle
Stream mapping:
  Stream #0:0 - #0:0 (copy)
  Stream #0:1 - #0:1 (copy)
Press [q] to stop, [?] for help
frame= 7166 fps=0.0 q=-1.0 size=  504481kB time=00:03:59.68 
bitrate=17242.6kbitsframe=10311 fps=0.0 q=-1.0 Lsize=  726141kB 
time=00:05:44.93 bitrate=17245.2kbits/s
video:715245kB audio:10529kB subtitle:0 global headers:0kB muxing overhead 
0.050533%
newlap tmp # ffmpeg -i orig.mp4 -c copy -metadata:s:v:0 rotate=90 r90.mp4




[gentoo-user] Re: off topic: rotating a video

2015-02-16 Thread Nikos Chantziaras

On 17/02/15 03:30, gottl...@nyu.edu wrote:

I built and tried mplayer.  Again not rotated.  I ran it from the
terminal.  Below is the output up to when I killed it

Is it possible I did the ffmpeg command wrong?


Sorry, that was my fault. mplayer doesn't support this :-P mpv does.

If you want to rotate the video so that all players work, you need to 
re-encode it. You will lose some quality doing this. And how to encode 
properly is a huge can of worms to open here (especially since I'm not 
an expert on this myself.)


Quick and dirty way:

  ffmpeg -i in.mp4 -vf transpose=1 out.mp4

This will probably produce crap. For a better quality encoding, do:

  ffmpeg -i in.mp4 -vf transpose=1 -vcodec libx264 out.mp4

For the latter to work, you need to enable the x264 USE flag of ffmpeg.




Re: [gentoo-user] Re: off topic: rotating a video

2015-02-16 Thread David Haller
Hello,

On Mon, 16 Feb 2015, gottl...@nyu.edu wrote:
I built and tried mplayer.  Again not rotated.  I ran it from the
terminal.  Below is the output up to when I killed it
[..]
VO: [xv] 1920x1080 = 1920x1080 Planar YV12 

FWIW: if it's just for watching the vid, try

mplayer -vf rotate=1 foo.mp4

That's rotating 90deg clockwise, see 'man mplayer', search for
'rotate', second hit:

[..]
-vf
[..]
   rotate[=0-7]
  Rotates  the  image  by 90 degrees and optionally flips it.  For
  values between 4-7 rotation is only done if the  movie  geometry
  is portrait and not landscape.

 0Rotate by 90 degrees clockwise and flip (default).
 1Rotate by 90 degrees clockwise.
 2Rotate by 90 degrees counterclockwise.
 3Rotate by 90 degrees counterclockwise and flip.

When using '-ovc copy', mencoder does not (as usual) seem to apply
this filter.

HTH,
-dnh

-- 
Wash: [..] this landings is gonna get pretty interesting Mal: Define
'interesting.' Wash: Oh, God, oh, God, we're all gonna die?  Mal: This is
the captain. We have a little problem with our entry sequence, so we may
experience some slight turbulence and then explode. -- Firefly Serenity