'vlcplayer'에 해당되는 글 1건

  1. 2019.08.14 핸드폰 비디오 rotate하기
Programming2019. 8. 14. 06:31

가끔씩 핸드폰 비디오가 90도 돌아가 있는 상태로 저장된것을 봅니다. MP4 header에 orientation이 있어서 새로 transcoding하는 것은 안좋은 상황. 비손실과 속도까지 고려하면 헤더만 change하는것이 좋음

 

1. FFMPEG으로 transcoding

# rotate video 1=90 cw, 2=90 ccw
# -filter:v transpose=1

ffmpeg -n -i 20190811_000.mp4 -filter:v transpose=2 20190811_000_r.mp4

 

ffmpeg -i in.mov -vf "transpose=1" out.mov

0 = 90CounterCLockwise and Vertical Flip (default)

1 = 90Clockwise

2 = 90CounterClockwise

3 = 90Clockwise and Vertical Flip

 

2. VLCPlayer로

Tools >> Preferences, Show settings->check "All"

Video >> Filters >> check Rotate video filter

Tools > Effects and Filters > Video Effects > Geometry

TODO:저장되나?

 

3. MP4 Header만 손수 update

https://superuser.com/questions/1307158/change-rotation-flag-in-mp4-video-without-losing-metadata

 

Change rotation flag in MP4 video (without losing metadata)

I just want to change the rotation flag in a .mp4 video file. Many similar questions exist, most answers suggest using ffmpeg -i input.mp4 -map_metadata 0 -metadata:s:v rotate=90 -codec copy outpu...

superuser.com

open mp4 with hex editor and search for vide to find the metadata of the video track
some rows above (for my files mostly 9, sometimes 12) you should see trak...\tkhd

  • no rotation:

    00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40
  • 180°:

    FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40
  • 90° cw:

    00 00 00 00 00 01 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40
  • 90° ccw:

    00 00 00 00 FF FF 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40

 

4. EXIF 정보만 update

program이 EXIF을 읽는다면

http://owl.phy.queensu.ca/~phil/exiftool/

 

ExifTool by Phil Harvey

0 (Information Type) AFCP, AIFF, APE, APP0, APP1, APP11, APP12, APP13, APP14, APP15, APP4, APP5, APP6, APP8, ASF, Audible, CanonVRD, Composite, DICOM, DNG, DV, DjVu, Ducky, EXE, EXIF, ExifTool, FITS, FLAC, FLIR, File, Flash, FlashPix, Font, FotoStation, GI

owl.phy.queensu.ca

exiftool -Orientation='Rotate 90 CW' INPUT_FILE

exiftool -Orientation='Rotate 270 CW' INPUT_FILE

 

---------------

핸드폰으로 찍은 비디오가 참 화질이 좋은데, mediainfo로 보면 진자 기가맥히게 설정이 잘 되어있네요. transcoding/다시encoding해서 퀄리티를 유지하기가 진짜 어려울 정도


Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.2
Format settings                          : CABAC / 1 Ref Frames

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2

'Programming' 카테고리의 다른 글

10 simple Linux tips in the command line  (0) 2019.08.20
Ubuntu upgrade 18.10 -> 19.04  (0) 2019.08.15
FFMPEG으로 비디오 파일에서 10초만 짤라서 만들기  (0) 2019.08.13
linux kernel build on ubuntu  (0) 2019.03.07
MinGW-w64 install  (0) 2017.01.22
Posted by 쁘레드