VideoHelp Forum

+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. I have downloaded a video from youtube that I wish to rotate the images and change it's aspect ratio.

    The original video appears to have been recorded on a cellphone in portrait mode; the resulting video is a narrow image that looks like you are looking out through a letterbox opening that has been turned sideways. Additionally, the video images appear to have been rotated to the left 90°(!!??).

    Here is the mediainfo for the video -

    Code:
    General
    Complete name                            : G:\Lavender Hill  Illegally park   14_05_21 part 2-XJnY-_oC_Ng.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media / Version 2
    Codec ID                                 : mp42 (isom/mp42)
    File size                                : 86.8 MiB
    Duration                                 : 14 min 53 s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 815 kb/s
    Encoded date                             : UTC 2021-05-15 23:53:56
    Tagged date                              : UTC 2021-05-15 23:53:56
    gsst                                     : 0
    gstd                                     : 893945
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3
    Format settings                          : CABAC / 3 Ref Frames
    Format settings, CABAC                   : Yes
    Format settings, Reference frames        : 3 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 14 min 53 s
    Bit rate                                 : 683 kb/s
    Width                                    : 406 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 0.564
    Frame rate mode                          : Constant
    Frame rate                               : 30.000 FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.078
    Stream size                              : 72.8 MiB (84%)
    Title                                    : ISO Media file produced by Google Inc. Created on: 05/15/2021.
    Encoded date                             : UTC 2021-05-15 23:53:56
    Tagged date                              : UTC 2021-05-15 23:53:56
    Color range                              : Limited
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    Codec configuration box                  : avcC
    
    Audio
    ID                                       : 2
    Format                                   : AAC LC
    Format/Info                              : Advanced Audio Codec Low Complexity
    Codec ID                                 : mp4a-40-2
    Duration                                 : 14 min 53 s
    Bit rate mode                            : Variable
    Bit rate                                 : 128 kb/s
    Channel(s)                               : 2 channels
    Channel layout                           : L R
    Sampling rate                            : 44.1 kHz
    Frame rate                               : 43.066 FPS (1024 SPF)
    Compression mode                         : Lossy
    Stream size                              : 13.6 MiB (16%)
    Title                                    : ISO Media file produced by Google Inc. Created on: 05/15/2021.
    Language                                 : English
    Encoded date                             : UTC 2021-05-15 23:53:56
    Tagged date                              : UTC 2021-05-15 23:53:56
    What are the best video editing software that allows this video to be rotated (90° to the right) AND adjust the video aspect ratio to 4:3 (1.3333)?

    Freeware software is preferred, but might have access to some payware/professional software if really necessary.

    Thanks for any and all constructive comments.
    Quote Quote  
  2. Member
    Join Date
    May 2005
    Location
    Australia
    Search Comp PM
    What's the YT link?
    Quote Quote  
  3. After downloading the video use ffmpeg to set the rotation flag:

    Code:
    ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=-90 output.mp4
    It will still be 16:9 though. If you really want 4:3 you can crop but you'll have to reencode:

    Code:
    ffmpeg -i input.mp4 -vf crop=1080:1440:0:240,rotate=90*PI/180:ow=1440:oh=1080 output2.mp4
    Image Attached Files
    Last edited by jagabo; 11th Sep 2021 at 08:25.
    Quote Quote  
  4. Member
    Join Date
    May 2005
    Location
    Australia
    Search Comp PM
    @jagabo, I can't get that second script to work; it gives me a zero byte file. The first works well.
    Quote Quote  
  5. Originally Posted by Alwyn View Post
    @jagabo, I can't get that second script to work; it gives me a zero byte file. The first works well.
    I tested the command line on the video downloaded from youtube just before posting it. And I just tested it again (copying and pasting from the post) just now. It works fine. Is your input file 1080 pixels wide and 1920 pixels tall? A smaller may fail.
    Quote Quote  
  6. Thanks for all the comments!

    Originally Posted by jagabo View Post
    . . . Is your input file 1080 pixels wide and 1920 pixels tall? A smaller may fail.
    What does this ^ mean? If input file size (pixels) is smaller than 1080W x 1920H, why should the conversion fail?

    Thanks.
    Quote Quote  
  7. Originally Posted by meeshu View Post
    Thanks for all the comments!

    Originally Posted by jagabo View Post
    . . . Is your input file 1080 pixels wide and 1920 pixels tall? A smaller may fail.
    What does this ^ mean? If input file size (pixels) is smaller than 1080W x 1920H, why should the conversion fail?
    The crop filter is used to reduce the frame from 1080x1920 to 1080x1440. Cropping requires that the output area come from inside the source frame. The arguments to the crop filter are the width and height of the cropped area and and x,y offset within the source. So this is a legal crop:

    -vf crop=out_w:out_h:x:y

    Code:
      0,0                          iw
        +--------------------------+
        |                          |
        |                          |
        |                          |
        |     x,y                  |
        |       +---------+        |
        |       |   ow    |        |
        |       |         |        |
        |       | oh      |        |
        |       |         |        |
        |       |         |        |
        |       +---------+        |
        |                          |
        |                          |
        |                          |
        |                          |
     ih +--------------------------+
    but if the source is too small you will get an illegal crop:
    Code:
      0,0                          iw
        +--------------------------+
        |                          |
        |                          |
        |                          |
        |     x,y                  |
        |       +---------+        |
        |       |   ow    |        |
        |       |         |        |
        |       | oh      |        |
     ih +-------|         |--------+
                |         |         
                +---------+
    ffmpeg will give an error message and abort.

    I knew the values to use to get a 4:3 frame from the middle of a 1920x1080 or 1080x1920 frame. And the video I downloaded from youtube was the latter of those two sizes. So I gave a command line specifically for that frame size.
    Last edited by jagabo; 12th Sep 2021 at 09:49.
    Quote Quote  
  8. Thanks for the excellent and detailed reply!!
    Quote Quote  
  9. It has to be said that the content of the video is totally hallucinatory, regardless of the 90° rotation... In what country do the cops stand by like this with a man behaving like that, with such an outspoken and confrontational attitude, plus a recording device ? Back in 2002 in south France I spent 14 hours in a jail cell for much, much less than that (was arrested for driving – unknowingly, at night, in a new town where I got lost trying to get back home in a lousy district – on a bus-only lane, arrest took abnormally long with no explanation, so I got pissed for about 30 seconds before being given the choke-hold treatment), and got sued for “outrage et rébellion”, it lasted 4 years until a final verdict came and I had to pay in the hundreds as “préjudice moral” (psychological damage) to the 3 cops involved (even though I also had to pay the psychological price since the whole ordeal was the final straw which made me stop college education – which ironically was considered an aggravating circumstance at the trial).
    Quote Quote  



Similar Threads