[FFmpeg-user] rotating an mp4
Michael Makuch
mike8 at makuch.org
Fri Jun 29 21:43:47 CEST 2012
I've found a few posts about how to rotate a video and am trying to do so. I'm
working with some vids taken on m y Samsung S11 Skyrocket/Android. Just gitted a
copy of ffmpeg from source.ffmpeg.org and built;
$ uname -a
Linux pecan 2.6.35.14-106.fc14.x86_64 #1 SMP Wed Nov 23 13:07:52 UTC 2011 x86_64
x86_64 x86_64 GNU/Linux
$ ffmpeg -h 2>&1 | head
ffmpeg version N-42033-gc1abfbc Copyright (c) 2000-2012 the FFmpeg developers
built on Jun 29 2012 10:54:53 with gcc 4.5.1 20100924 (Red Hat 4.5.1-4)
configuration:
libavutil 51. 63.100 / 51. 63.100
libavcodec 54. 29.101 / 54. 29.101
libavformat 54. 12.100 / 54. 12.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 3. 0.100 / 3. 0.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
and the file I'm working on;
$ ffmpeg -i 20120401_095652.mp4
ffmpeg version N-42033-gc1abfbc Copyright (c) 2000-2012 the FFmpeg developers
built on Jun 29 2012 10:54:53 with gcc 4.5.1 20100924 (Red Hat 4.5.1-4)
configuration:
libavutil 51. 63.100 / 51. 63.100
libavcodec 54. 29.101 / 54. 29.101
libavformat 54. 12.100 / 54. 12.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 3. 0.100 / 3. 0.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x21bc120] multiple edit list entries, a/v desync
might occur, patch welcome
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20120401_095652.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 1946-04-01 14:57:26
Duration: 00:00:34.21, start: 0.000000, bitrate: 17054 kb/s
Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, s16, 62 kb/s
Metadata:
creation_time : 1946-04-01 14:57:26
handler_name : SoundHandle
Stream #0:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080, 17054 kb/s, SAR 65536:65536 DAR 16:9, 30.04 fps, 30.08 tbr, 90k tbn,
180k tbc
Metadata:
rotate : 90
creation_time : 1946-04-01 14:57:26
handler_name : VideoHandle
At least one output file must be specified
and here's how I'm trying to rotate;
$ ffmpeg -i 20120401_095652.mp4 -vf "transpose=1" x.mp4
ffmpeg version N-42033-gc1abfbc Copyright (c) 2000-2012 the FFmpeg developers
built on Jun 29 2012 10:54:53 with gcc 4.5.1 20100924 (Red Hat 4.5.1-4)
configuration:
libavutil 51. 63.100 / 51. 63.100
libavcodec 54. 29.101 / 54. 29.101
libavformat 54. 12.100 / 54. 12.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 3. 0.100 / 3. 0.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x273d120] multiple edit list entries, a/v desync
might occur, patch welcome
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20120401_095652.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 1946-04-01 14:57:26
Duration: 00:00:34.21, start: 0.000000, bitrate: 17054 kb/s
Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, s16, 62 kb/s
Metadata:
creation_time : 1946-04-01 14:57:26
handler_name : SoundHandle
Stream #0:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080, 17054 kb/s, SAR 65536:65536 DAR 16:9, 30.04 fps, 30.08 tbr, 90k tbn,
180k tbc
Metadata:
rotate : 90
creation_time : 1946-04-01 14:57:26
handler_name : VideoHandle
[graph 0 input from stream 0:1 @ 0x2760240] w:1920 h:1080 pixfmt:yuv420p
tb:1/90000 fr:361/12 sar:1/1 sws_param:flags=2
[output stream 0:0 @ 0x2739dc0] No opaque field provided
[graph 1 input from stream 0:0 @ 0x276c220] tb:1/48000 samplefmt:s16
samplerate:48000 chlayout:0x4
[auto-inserted resampler 0 @ 0x27411c0] chl:mono fmt:s16 r:48000Hz -> chl:mono
fmt:flt r:48000Hz
[NULL @ 0x274eaa0] Codec is experimental but experimental codecs are not
enabled, try -strict -2
Output #0, mp4, to 'x.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
Stream #0:0(eng): Video: mpeg4, yuv420p, 1080x1920 [SAR 1:1 DAR 9:16],
q=2-31, 200 kb/s, 90k tbn, 30.08 tbc
Metadata:
rotate : 90
creation_time : 1946-04-01 14:57:26
handler_name : VideoHandle
Stream #0:1(eng): Audio: none, 48000 Hz, mono, flt, 128 kb/s
Metadata:
creation_time : 1946-04-01 14:57:26
handler_name : SoundHandle
Stream mapping:
Stream #0:1 -> #0:0 (h264 -> mpeg4)
Stream #0:0 -> #0:1 (aac -> aac)
Error while opening encoder for output stream #0:1 - maybe incorrect parameters
such as bit_rate, rate, width or height
I see that it's trying to convert from h264 to mpeg, I guess just based on the
out file .mp4. So I try forcing -vcodec h264 but I get 'Unknown encoder' - even
though 'ffmpeg -codecs' shows it there;
$ ffmpeg -codecs 2>&1 | grep h264
D V D B h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
$ ffmpeg -i 20120401_095652.mp4 -vf "transpose=1" -vcodec h264 x.mp4
ffmpeg version N-42033-gc1abfbc Copyright (c) 2000-2012 the FFmpeg developers
built on Jun 29 2012 10:54:53 with gcc 4.5.1 20100924 (Red Hat 4.5.1-4)
configuration:
libavutil 51. 63.100 / 51. 63.100
libavcodec 54. 29.101 / 54. 29.101
libavformat 54. 12.100 / 54. 12.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 3. 0.100 / 3. 0.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x320f120] multiple edit list entries, a/v desync
might occur, patch welcome
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20120401_095652.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 1946-04-01 14:57:26
Duration: 00:00:34.21, start: 0.000000, bitrate: 17054 kb/s
Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, s16, 62 kb/s
Metadata:
creation_time : 1946-04-01 14:57:26
handler_name : SoundHandle
Stream #0:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080, 17054 kb/s, SAR 65536:65536 DAR 16:9, 30.04 fps, 30.08 tbr, 90k tbn,
180k tbc
Metadata:
rotate : 90
creation_time : 1946-04-01 14:57:26
handler_name : VideoHandle
Unknown encoder 'h264'
I don't want to resize nor modify either stream at all, just want to rotate it
90 degrees. I see that the input is 1920x1080 and the output is 1080x1920 as
expected.
Any clues are appreciated.
Thanks
Mike
More information about the ffmpeg-user
mailing list