[libav-bugs] [Bug 832] New: avcodec copy turns video upside down

bugzilla at aruru.libav.org bugzilla at aruru.libav.org
Sun Mar 15 03:40:18 CET 2015


https://bugzilla.libav.org/show_bug.cgi?id=832

            Bug ID: 832
           Summary: avcodec copy turns video upside down
           Product: Libav
           Version: 11
          Hardware: X86
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: ---
         Component: libavformat
          Assignee: bugzilla at libav.org
          Reporter: andrew.moise at gmail.com

I was trying to trim a video into chunks, and avconv turned my video upside
down when I did. I simplified to explain the underlying problem responsible: I
took two tiny videos with my phone, one with the phone right side up, one with
the phone upside down. The phone detects that it is upside down in the upside
down one, so that both of the videos display right side up. The videos are:

filmed-right-side-up.mp4
filmed-upside-down.mp4

You can look at them and verify that they both display right side up (i.e. the
phone flips the video when it is upside down). I then copy both the videos
using avconv. The output video that was originally filmed with the phone right
side up is still right side up. The video that was filmed with the phone upside
down is now upside down.

Full output of the copy commands with debugging is below. Please accept my
apologies if this is expected behavior (i.e. avconv is designed to copy the
stream but discard some bit which indicates that the stream data is upside
down) -- but, it was certainly surprising to me, and I can't imagine a use of
avconv (to apply filters, trim streams, whatever) that includes discarding this
bit as a desirable side effect.

Input and output files I'll upload to FTP. Full command output is below:

(jessie)moise at localhost:/media/removable/SD Card/DCIM/100LGDSC$ avconv -v 9
-loglevel 99 -i filmed-right-side-up.mp4 -vcodec copy -acodec copy
filmed-right-side-up-then-copied.mp4
avconv version 11.2-6:11.2-1, Copyright (c) 2000-2014 the Libav developers
  built on Jan 17 2015 21:51:46 with gcc 4.9.2 (Debian 4.9.2-9)
  configuration: --arch=amd64 --enable-pthreads --enable-runtime-cpudetect
--extra-version='6:11.2-1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr
--disable-avserver --enable-bzlib --enable-libdc1394 --enable-libfreetype
--enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame
--enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus
--enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib
--enable-gpl --enable-swscale --enable-libcdio --enable-x11grab
--enable-libx264 --enable-libxvid --shlibdir=/usr/lib/x86_64-linux-gnu
--enable-shared --disable-static
  libavutil     54.  3. 0 / 54.  3. 0
  libavcodec    56.  1. 0 / 56.  1. 0
  libavformat   56.  1. 0 / 56.  1. 0
  libavdevice   55.  0. 0 / 55.  0. 0
  libavfilter    5.  0. 0 /  5.  0. 0
  libavresample  2.  1. 0 /  2.  1. 0
  libswscale     3.  0. 0 /  3.  0. 0
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set libav* logging level) with
argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set libav* logging
level) with argument '99'.
Reading option '-i' ... matched as input file with argument
'filmed-right-side-up.mp4'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'copy'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec
('copy' to copy stream)) with argument 'copy'.
Reading option 'filmed-right-side-up-then-copied.mp4' ... matched as output
file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set libav* logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file filmed-right-side-up.mp4.
Successfully parsed a group of options.
Opening an input file: filmed-right-side-up.mp4.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1dce500] Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1dce500] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1dce500] All info found
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'filmed-right-side-up.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2015-03-15 02:20:04
  Duration: 00:00:02.60, start: 0.000000, bitrate: 9426 kb/s
    Stream #0.0(eng), 20, 1/90000: Video: h264 (Baseline), yuv420p, 1280x720,
0/1, 8889 kb/s, PAR 65536:65536 DAR 16:9, 17.17 fps, 90k tbn (default)
    Metadata:
      creation_time   : 2015-03-15 02:20:04
      encoder         :                                
    Stream #0.1(eng), 49, 1/48000: Audio: aac, 48000 Hz, stereo, fltp, 96 kb/s
(default)
    Metadata:
      creation_time   : 2015-03-15 02:20:04
Successfully opened the file.
Parsing a group of options: output file filmed-right-side-up-then-copied.mp4.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument copy.
Applying option acodec (force audio codec ('copy' to copy stream)) with
argument copy.
Successfully parsed a group of options.
Opening an output file: filmed-right-side-up-then-copied.mp4.
Successfully opened the file.
Output #0, mp4, to 'filmed-right-side-up-then-copied.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2015-03-15 02:20:04
    encoder         : Lavf56.1.0
    Stream #0.0(eng), 0, 1/90000: Video: libx264, yuv420p, 1280x720 [PAR
65536:65536 DAR 16:9], 1/90000, q=2-31, 8889 kb/s, 90k tbn, 90k tbc (default)
    Metadata:
      creation_time   : 2015-03-15 02:20:04
      encoder         :                                
    Stream #0.1(eng), 0, 1/48000: Audio: aac, 48000 Hz, stereo, 96 kb/s
(default)
    Metadata:
      creation_time   : 2015-03-15 02:20:04
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press ctrl-c to stop encoding
No more output streams to write to, finishing.
frame=   40 fps=  0 q=-1.0 Lsize=    2602kB time=2.31 bitrate=9232.2kbits/s    
video:2569kB audio:30kB other streams:0kB global headers:0kB muxing overhead:
0.106178%
Input file #0 (filmed-right-side-up.mp4):
  Input stream #0:0 (video): 40 packets read (2630329 bytes); 
  Input stream #0:1 (audio): 122 packets read (31232 bytes); 
  Total: 162 packets (2661561 bytes) demuxed
Output file #0 (filmed-right-side-up-then-copied.mp4):
  Output stream #0:0 (video): 40 packets muxed (2630329 bytes); 
  Output stream #0:1 (audio): 122 packets muxed (31232 bytes); 
  Total: 162 packets (2661561 bytes) muxed
(jessie)moise at localhost:/media/removable/SD Card/DCIM/100LGDSC$



(jessie)moise at localhost:/media/removable/SD Card/DCIM/100LGDSC$ avconv -v 9
-loglevel 99 -i filmed-upside-down.mp4 -vcodec copy -acodec copy
filmed-upside-down-then-copied.mp4
avconv version 11.2-6:11.2-1, Copyright (c) 2000-2014 the Libav developers
  built on Jan 17 2015 21:51:46 with gcc 4.9.2 (Debian 4.9.2-9)
  configuration: --arch=amd64 --enable-pthreads --enable-runtime-cpudetect
--extra-version='6:11.2-1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr
--disable-avserver --enable-bzlib --enable-libdc1394 --enable-libfreetype
--enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame
--enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus
--enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib
--enable-gpl --enable-swscale --enable-libcdio --enable-x11grab
--enable-libx264 --enable-libxvid --shlibdir=/usr/lib/x86_64-linux-gnu
--enable-shared --disable-static
  libavutil     54.  3. 0 / 54.  3. 0
  libavcodec    56.  1. 0 / 56.  1. 0
  libavformat   56.  1. 0 / 56.  1. 0
  libavdevice   55.  0. 0 / 55.  0. 0
  libavfilter    5.  0. 0 /  5.  0. 0
  libavresample  2.  1. 0 /  2.  1. 0
  libswscale     3.  0. 0 /  3.  0. 0
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set libav* logging level) with
argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set libav* logging
level) with argument '99'.
Reading option '-i' ... matched as input file with argument
'filmed-upside-down.mp4'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'copy'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec
('copy' to copy stream)) with argument 'copy'.
Reading option 'filmed-upside-down-then-copied.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set libav* logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file filmed-upside-down.mp4.
Successfully parsed a group of options.
Opening an input file: filmed-upside-down.mp4.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x2409500] Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x2409500] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x2409500] sample aspect ratio already set to 1:1,
ignoring 'pasp' atom (65536:65536)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x2409500] All info found
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'filmed-upside-down.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2015-03-15 02:20:15
  Duration: 00:00:02.68, start: 0.000000, bitrate: 9416 kb/s
    Stream #0.0(eng), 20, 1/90000: Video: h264 (Baseline), yuv420p, 1280x720,
0/1, 8822 kb/s, PAR 1:1 DAR 16:9, 17.17 fps, 90k tbn (default)
    Metadata:
      creation_time   : 2015-03-15 02:20:15
      encoder         :                                
    Side data:
      displaymatrix: rotation of 180.00 degrees
    Stream #0.1(eng), 49, 1/48000: Audio: aac, 48000 Hz, stereo, fltp, 96 kb/s
(default)
    Metadata:
      creation_time   : 2015-03-15 02:20:15
Successfully opened the file.
Parsing a group of options: output file filmed-upside-down-then-copied.mp4.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument copy.
Applying option acodec (force audio codec ('copy' to copy stream)) with
argument copy.
Successfully parsed a group of options.
Opening an output file: filmed-upside-down-then-copied.mp4.
Successfully opened the file.
Output #0, mp4, to 'filmed-upside-down-then-copied.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2015-03-15 02:20:15
    encoder         : Lavf56.1.0
    Stream #0.0(eng), 0, 1/90000: Video: libx264, yuv420p, 1280x720 [PAR 1:1
DAR 16:9], 1/90000, q=2-31, 8822 kb/s, 90k tbn, 90k tbc (default)
    Metadata:
      creation_time   : 2015-03-15 02:20:15
      encoder         :                                
    Stream #0.1(eng), 0, 1/48000: Audio: aac, 48000 Hz, stereo, 96 kb/s
(default)
    Metadata:
      creation_time   : 2015-03-15 02:20:15
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press ctrl-c to stop encoding
No more output streams to write to, finishing.
frame=   42 fps=  0 q=-1.0 Lsize=    2697kB time=2.42 bitrate=9121.1kbits/s    
video:2663kB audio:32kB other streams:0kB global headers:0kB muxing overhead:
0.104466%
Input file #0 (filmed-upside-down.mp4):
  Input stream #0:0 (video): 42 packets read (2726548 bytes); 
  Input stream #0:1 (audio): 126 packets read (32256 bytes); 
  Total: 168 packets (2758804 bytes) demuxed
Output file #0 (filmed-upside-down-then-copied.mp4):
  Output stream #0:0 (video): 42 packets muxed (2726548 bytes); 
  Output stream #0:1 (audio): 126 packets muxed (32256 bytes); 
  Total: 168 packets (2758804 bytes) muxed
(jessie)moise at localhost:/media/removable/SD Card/DCIM/100LGDSC$

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libav.org/pipermail/libav-bugs/attachments/20150315/9ea1a413/attachment-0001.html>


More information about the libav-bugs mailing list