2017-01-26 72 views
0

我想將.mov文件轉換爲.mp4,以便它們可以在任何設備上播放。我使用的是avconv v0.20-6:9.20-0ubuntu0.14.04.1(建立於2016年12月7日,gcc 4,8)的ubuntu 14.04。avconv輸出每個視頻的橫向旋轉,無論元數據或轉置

如果我只是嘗試:

avconv -i input.mov output.mp4 

將其轉換爲MP4罰款,但如果視頻的畫像會自動旋轉爲橫向。如果視頻是橫向的,則不會旋轉。我也試過用我的android設備拍攝的mp4視頻,同樣的事情發生。這是一個MOV文件中的原始元數據(命令來獲取元數據是第一行):

avconv -i IMG_0022.MOV 
avconv version 9.20-6:9.20-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers 
    built on Dec 7 2016 21:22:31 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3) 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1d5e240] Could not find codec parameters (Data: mebx/0x7862656D, 0 kb/s) 
    Last message repeated 1 times 
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_0022.MOV': 
    Metadata: 
    major_brand  : qt 
    minor_version : 0 
    compatible_brands: qt 
    creation_time : 2017-01-25 22:58:59 
    Duration: 00:00:03.18, start: 0.000000, bitrate: 10705 kb/s 
    Stream #0.0(und): Video: h264 (Baseline), yuv420p, 1280x720, 10823 kb/s, 24.01 fps, 24 tbr, 600 tbn 
    Metadata: 
     creation_time : 2017-01-25 22:58:59 
    Stream #0.1(und): Audio: aac, 44100 Hz, mono, fltp, 61 kb/s 
    Metadata: 
     creation_time : 2017-01-25 22:58:59 
    Stream #0.2(und): Data: mebx/0x7862656D, 0 kb/s 
    Metadata: 
     creation_time : 2017-01-25 22:58:59 
    Stream #0.3(und): Data: mebx/0x7862656D, 0 kb/s 
    Metadata: 
     creation_time : 2017-01-25 22:58:59 
At least one output file must be specified 

當我跑

avconv -i IMG_0022.mov -strict -2 out.mp4 

這是我得到:

avconv -i IMG_0022.MOV -strict -2 out.mp4 
avconv version 9.20-6:9.20-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers 
    built on Dec 7 2016 21:22:31 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3) 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1fdab00] Could not find codec parameters (Data: mebx/0x7862656D, 0 kb/s) 
    Last message repeated 1 times 
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_0022.MOV': 
    Metadata: 
    major_brand  : qt 
    minor_version : 0 
    compatible_brands: qt 
    creation_time : 2017-01-25 22:58:59 
    Duration: 00:00:03.18, start: 0.000000, bitrate: 10705 kb/s 
    Stream #0.0(und): Video: h264 (Baseline), yuv420p, 1280x720, 10823 kb/s, 24.01 fps, 24 tbr, 600 tbn 
    Metadata: 
     creation_time : 2017-01-25 22:58:59 
    Stream #0.1(und): Audio: aac, 44100 Hz, mono, fltp, 61 kb/s 
    Metadata: 
     creation_time : 2017-01-25 22:58:59 
    Stream #0.2(und): Data: mebx/0x7862656D, 0 kb/s 
    Metadata: 
     creation_time : 2017-01-25 22:58:59 
    Stream #0.3(und): Data: mebx/0x7862656D, 0 kb/s 
    Metadata: 
     creation_time : 2017-01-25 22:58:59 
File 'out.mp4' already exists. Overwrite ? [y/N] y 
[libx264 @ 0x1ff9360] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2 
[libx264 @ 0x1ff9360] profile High, level 3.1 
[libx264 @ 0x1ff9360] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.25 aq=1:1.00 
Output #0, mp4, to 'out.mp4': 
    Metadata: 
    major_brand  : qt 
    minor_version : 0 
    compatible_brands: qt 
    creation_time : 2017-01-25 22:58:59 
    encoder   : Lavf54.20.4 
    Stream #0.0(und): Video: libx264, yuv420p, 1280x720, q=-1--1, 22500 tbn, 24.01 tbc 
    Metadata: 
     creation_time : 2017-01-25 22:58:59 
    Stream #0.1(und): Audio: aac, 44100 Hz, mono, fltp, 200 kb/s 
    Metadata: 
     creation_time : 2017-01-25 22:58:59 
Stream mapping: 
    Stream #0:0 -> #0:0 (h264 -> libx264) 
    Stream #0:1 -> #0:1 (aac -> aac) 
Press ctrl-c to stop encoding 
frame= 75 fps= 29 q=32765.0 Lsize= 1673kB time=3.04 bitrate=4507.2kbits/s 
video:595kB audio:74kB global headers:0kB muxing overhead 149.985988% 
[libx264 @ 0x1ff9360] frame I:1  Avg QP:27.41 size: 47219 
[libx264 @ 0x1ff9360] frame P:43 Avg QP:25.60 size: 28610 
[libx264 @ 0x1ff9360] frame B:31 Avg QP:27.26 size: 11417 
[libx264 @ 0x1ff9360] consecutive B-frames: 21.3% 66.7% 12.0% 0.0% 
[libx264 @ 0x1ff9360] mb I I16..4: 1.5% 76.0% 22.5% 
[libx264 @ 0x1ff9360] mb P I16..4: 2.5% 13.7% 5.9% P16..4: 50.4% 15.5% 7.5% 0.0% 0.0% skip: 4.4% 
[libx264 @ 0x1ff9360] mb B I16..4: 0.5% 2.1% 1.0% B16..8: 52.8% 4.8% 0.8% direct: 6.6% skip:31.4% L0:44.6% L1:51.8% BI: 3.6% 
[libx264 @ 0x1ff9360] 8x8 transform intra:62.9% inter:58.8% 
[libx264 @ 0x1ff9360] coded y,uvDC,uvAC intra: 79.0% 89.8% 36.9% inter: 33.5% 55.1% 1.6% 
[libx264 @ 0x1ff9360] i16 v,h,dc,p: 7% 11% 32% 50% 
[libx264 @ 0x1ff9360] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 8% 9% 17% 3% 20% 25% 10% 3% 4% 
[libx264 @ 0x1ff9360] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 12% 22% 4% 18% 19% 6% 3% 3% 
[libx264 @ 0x1ff9360] i8c dc,h,v,p: 59% 18% 15% 8% 
[libx264 @ 0x1ff9360] Weighted P-Frames: Y:27.9% UV:16.3% 
[libx264 @ 0x1ff9360] ref P L0: 67.4% 15.9% 12.2% 3.9% 0.6% 
[libx264 @ 0x1ff9360] ref B L0: 92.0% 7.4% 0.5% 
[libx264 @ 0x1ff9360] ref B L1: 99.2% 0.8% 
[libx264 @ 0x1ff9360] kb/s:4178.51 

我知道轉換過程中有一條警告消息,但我仍然獲得有效的mp4,因此我不知道它是否是問題。 我一直在使用轉= 1試過,但它不會影響輸出都: avconv -i input.mov -vf轉= 1 out.mp4

回答

0

我嘗試了一下,終於找到了工作的組合:

avconv -i input.mov -vf "transpose=1" -codec:v libx264 -strict experimental out.mp4 

我認爲這是我必須-strict -2代替-strict實驗,雖然從文檔我不能告訴什麼2名映射到爲什麼會導致它忽略調換。我曾嘗試過指定編解碼器,但它沒有奏效,但也許它是我以前使用的編解碼器規範導致它被忽略的特定組合或參數。