← Back to team overview

linux-traipu team mailing list archive

[Bug 1264653] Re: Photo to Full HD video crop and scale width rounding error

 

You may also follow this simple guide to crop video with or without
change the video aspect ratio at  at http://www.idealshare.net/video-
converter/video-cropper.html

-- 
You received this bug notification because you are a member of UBUNTU -
AL - BR, which is subscribed to OpenShot Video Editor.
https://bugs.launchpad.net/bugs/1264653

Title:
  Photo to Full HD video crop and scale width rounding error

Status in OpenShot Video Editor:
  New

Bug description:
  Architecture (64 bits or 32 bits) : 32 bits
  Operating System & version: Ubuntu 13.10 "saucy"
  Installation Method : via Ubuntu Software Center
  Version of Openshot installed : 1.4.3
  BZR Revision used (if any) : None
  MLT/melt version: I do not know, what this mean 
  FFmpeg (i.e.libavcodec) version :  avconv version 0.8.9-6:0.8.9-0ubuntu0.13.10.1
  FFmpeg installation : Not installed.

  This  bug can be by 100% reproduced through following actions:
  1) Set the project default size in the preferences to 1080p 25 fps
  2) Set the default clip length in the prefernces to 7 seconds
  3) Create a new project
  4) Create 3 tracks
  5) Import a soundfile of adequate length seconds duration to track 0
  6) Import 2 black images and a photo (5184x3456 18 megapixel) into the project (track 1 and 2) incl. cross-fades
  7) Edit the clip layout keyframes to zoom in or zoom out the photo in every clip
  8) Export the video using the mp4 (h.264) codec at high quality
  9) Play the buggy video in vlc video player in full screen mode: vlc "<FilePath>" -f

  On the right side of the player pixel column 1920 disappears and
  reappears frequently. If the still file name is displayed by vlc
  player you can see that the whole frame is freqently chattering by one
  pixel from the left to the right and back again.

  This chattering reduces the subjective enjoyment of the viewer by more
  than 66 %. From my point of view, a failure like this is not an
  option. So I ask you to solve this problem before you launch OpenShot
  V.2.0.

  avprobe version 0.8.9-6:0.8.9-0ubuntu0.13.10.1, Copyright (c) 2007-2013 the Libav developers
    built on Nov  9 2013 19:15:22 with gcc 4.8.1
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Test1.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf53.21.1
    Duration: 00:00:11.72, start: 0.000000, bitrate: 7170 kb/s
      Stream #0.0(und): Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 6973 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
      Stream #0.1(und): Audio: ac3, 44100 Hz, stereo, s16, 191 kb/s

  
  This problem is also visible while playing the timeline (preview) within OpenShot.

  This may be a problem within the libav library you use in the OpenShot
  crop and scale function.

  Please have a look on the crop and scale function in my own application KeyframeEditor:
  https://launchpad.net/keyframeeditor

  I detected and reproduced the the same libav problem, when cropping
  and scaling with avconv in KeyframeEditor.

  PROPOSED WORKAROUND:
  I worked around this problem in KeyframeEditor by using ImageMagick for cropping and scaling and to
  give the position and size parameters as exact float values to ImageMagick.

  Test script:
  #!/bin/bash
  #
  # Custom crop and scale method
  #
  # Interface
  echo "Image input path ....: $1"
  echo "Crop width ..........: $2"
  echo "Crop height .........: $3"
  echo "Crop x ..............: $4"
  echo "Crop y ..............: $5"
  echo "Project width .......: $6"
  echo "Project height ......: $7"
  echo "Image output path ...: $8"
  #
  # Note: This script must be capable to overwrite the output path without user interaction.
  # Note: This script must be capable to to overwrite the input path by the output path.
  #
  # Action
  # Using ImageMagick
  convert "$1" -crop "$2x$3+$4+$5" -resize "$6x$7" "$8"
  EXITCODE=$?
  if [ ! "$EXITCODE" == "0" ]; then
     echo "ERROR: convert canceled with exit code $EXITCODE."
     exit 1
  fi
  echo "Complete."
  # Exit
  exit 0

  Inside Keyframe editor I call "convert" only one time and order to
  render the whole clip in one pass. This is more efficient than to call
  convert at cropping every frame.

  See KeyframeEditor.py / object ExportVideoFrame / thread handler
  CropImagesFromPhoto / after elif self.sCropScaleTool == "ImageMagick".

  Currently I bypass this problem within OpenShot 1.4.3 by using the
  methods I described in Chapter III and IV of the KeyframEditor
  tutorial, which is available in the KeyframeEditor README file.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openshot/+bug/1264653/+subscriptions


References