avconv在尝试下采样mp4video时创建零字节文件

我正在使用我的手机创建一个时间推移video,我试图从1080p到640×480进行缩减采样。

根据这个答案 ,我正在使用avconv命令

 avconv -i input.mp4 -s 640x480 output.mp4 

但它创建了一个0字节的文件,显然什么都没包含。

该命令的输出如下

 a@b:~$avconv -i ./Videos/CivilStudy.mp4 -s 640x480 ./abc.mp4 avconv version 9.16-6:9.16-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers built on Aug 10 2014 18:19:26 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './Videos/CivilStudy.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf52.64.2 Duration: 00:00:43.58, start: 0.000000, bitrate: 10159 kb/s Stream #0.0(und): Video: mpeg4 (Simple Profile), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 10025 kb/s, 24 fps, 24 tbr, 24 tbn, 24 tbc Metadata: creation_time : 1970-01-01 00:00:00 Stream #0.1(und): Audio: aac, 44100 Hz, mono, fltp, 129 kb/s Metadata: creation_time : 1970-01-01 00:00:00 [libx264 @ 0x843bde0] using SAR=4/3 [libx264 @ 0x843bde0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64 [libx264 @ 0x843bde0] profile High, level 3.0 [libx264 @ 0x843bde0] 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=3 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 encoder 'aac' is experimental and might produce bad results. Add '-strict experimental' if you want to use it 

现在我该怎么做?

在此转换期间,video和音频都需要从原始文件解码,然后编码到目标文件。 在这种情况下,原始文件恰好具有用’aac’(高级音频编码)编码的音频。 音频的解码不是问题,仅对’aac’编码的音频进行编码似乎是有问题的。

请参阅上面输出的最后两行:

 encoder 'aac' is experimental and might produce bad results. Add '-strict experimental' if you want to use it 

如消息中所述,编码器’aac’是实验性的。 无论如何要使用它添加’-strict experimental’,如下所示:

 avconv -i input.mp4 -s 640x480 -strict experimental output.mp4 

这将使用实验编码器产生具有嵌入音频的video,该video用’aac’编码。 如果省略该参数,则不创建输出(仅零字节文件)。 因此,在这种情况下不使用编码器。 我能够毫无问题地转换这样的video。 如果编解码器不适合您,您可以为此类音频指定其他编解码器(以mp3为例):

 avconv -i input.mp4 -acodec mp3 -s 640x480 output.mp4 

如果录音完全没有声音 – 因为你正在转换时间流逝 – 你可能根本不想嵌入音频。 要实现此目的,请使用参数-an

 avconv -i input.mp4 -an -s 640x480 output.mp4