1. 获取ffmpeg

1. 获取ffmpeg

我开始使用此链接中的建议:

如何从终端合并视频文件?

我尝试将一组小的 .avi 文件合并为一个大文件时,前 6 次都成功了。但是,此后它似乎在终端中按部就班,但输出文件只有 632-648 字节。我尝试过重新启动,但什么也没改变。以下是我所采取步骤的详细摘要:

$ sudo apt-get install mencoder libxvidcore4 libmp3lame0
Reading package
lists... Done Building dependency tree        Reading state
information... Done libmp3lame0 is already the newest version.
libxvidcore4 is already the newest version. mencoder is already the
newest version. 0 upgraded, 0 newly installed, 0 to remove and 55 not
upgraded.

一切似乎都是最新的,所以我做了以下事情:

mencoder -ovc copy -oac mp3lame VID00303.AVI VID00304.AVI VID00305.AVI VID00306.AVI VID00307.AVI -o joined-video.avi

这是前六次成功运行的命令,可以生成完美同步和合并的视频文件。现在它不起作用了。这是我运行此命令时在终端中得到的结果的副本:

MEncoder 1.1-4.8 (C) 2000-2012 MPlayer Team success: format: 0  data:
0x0 - 0x38c2466 libavformat version 54.20.4 (external) Mismatching
header version 54.20.3 AVI file format detected. [aviheader] Video
stream found, -vid 0 [aviheader] Audio stream found, -aid 1 VIDEO: 
[H264]  1280x720  24bpp  30.000 fps  8304.7 kbps (1013.8 kbyte/s) [V]
filefmt:3  fourcc:0x34363248  size:1280x720  fps:30.000  ftime:=0.0333
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 54.35.0 (external) AUDIO: 44100 Hz, 1 ch, s16le,
177.4 kbit/25.15% (ratio: 22179->88200) Selected audio codec: [ffadpcmms] afm: ffmpeg (FFmpeg MS ADPCM audio)
==========================================================================
videocodec: framecopy (1280x720 24bpp fourcc=34363248) MP3 audio
selected. Writing header... ODML: Aspect information not (yet?)
available or unspecified, not writing vprp header. Writing header...
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header. Pos:   0.7s     23f ( 2%)  0.00fps Trem:   0min  
0mb  A-V:0.068 [0:132]

Skipping frame! Pos:   1.2s     38f ( 3%)  0.00fps Trem:   0min   0mb 
A-V:0.068 [8737:135]

Skipping frame! Pos:  56.0s   1682f (100%) 316.17fps Trem:   0min  
0mb  A-V:0.011 [8312:130] success: format: 0  data: 0x0 - 0x286ce54
AVI file format detected. [aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1 VIDEO:  [H264]  1280x720  24bpp
30.000 fps  8297.5 kbps (1012.9 kbyte/s) [V] filefmt:3  fourcc:0x34363248  size:1280x720  fps:30.000  ftime:=0.0333
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 1 ch, s16le, 177.4 kbit/25.15% (ratio: 22179->88200)
Selected audio codec: [ffadpcmms] afm: ffmpeg (FFmpeg MS ADPCM audio)
==========================================================================
videocodec: framecopy (1280x720 24bpp fourcc=34363248) Pos:  95.9s  
2881f (100%) 326.20fps Trem:   0min   0mb  A-V:0.023 [8306:132]
success: format: 0  data: 0x0 - 0x2759266 AVI file format detected.
[aviheader] Video stream found, -vid 0 [aviheader] Audio stream found,
-aid 1 VIDEO:  [H264]  1280x720  24bpp  30.000 fps  8305.0 kbps (1013.8 kbyte/s) [V] filefmt:3  fourcc:0x34363248  size:1280x720 
fps:30.000  ftime:=0.0333
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 1 ch, s16le, 177.4 kbit/25.15% (ratio: 22179->88200)
Selected audio codec: [ffadpcmms] afm: ffmpeg (FFmpeg MS ADPCM audio)
==========================================================================
videocodec: framecopy (1280x720 24bpp fourcc=34363248) Pos:  96.5s  
2898f ( 3%) 324.52fps Trem:   4min   0mb  A-V:0.070 [8308:132]

Skipping frame! Pos: 134.8s   4047f (100%) 330.26fps Trem:   0min  
0mb  A-V:0.022 [8306:133] success: format: 0  data: 0x0 - 0xd5549a AVI
file format detected. [aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1 VIDEO:  [H264]  1280x720  24bpp
30.000 fps  8307.1 kbps (1014.0 kbyte/s) [V] filefmt:3  fourcc:0x34363248  size:1280x720  fps:30.000  ftime:=0.0333
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 1 ch, s16le, 177.4 kbit/25.15% (ratio: 22179->88200)
Selected audio codec: [ffadpcmms] afm: ffmpeg (FFmpeg MS ADPCM audio)
==========================================================================
videocodec: framecopy (1280x720 24bpp fourcc=34363248) Pos: 147.9s  
4442f (100%) 327.29fps Trem:   0min   0mb  A-V:0.028 [8306:134]
success: format: 0  data: 0x0 - 0x18e672a AVI file format detected.
[aviheader] Video stream found, -vid 0 [aviheader] Audio stream found,
-aid 1 VIDEO:  [H264]  1280x720  24bpp  30.000 fps  8292.1 kbps (1012.2 kbyte/s) [V] filefmt:3  fourcc:0x34363248  size:1280x720 
fps:30.000  ftime:=0.0333
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 1 ch, s16le, 177.4 kbit/25.15% (ratio: 22179->88200)
Selected audio codec: [ffadpcmms] afm: ffmpeg (FFmpeg MS ADPCM audio)
==========================================================================
videocodec: framecopy (1280x720 24bpp fourcc=34363248) Pos: 148.9s  
4472f ( 6%) 325.90fps Trem:   3min   0mb  A-V:0.068 [8306:134]

Skipping frame! Pos: 172.5s   5181f (100%) 330.72fps Trem:   0min  
0mb  A-V:-0.011 [8301:134] Writing index... Writing header... ODML:
Aspect information not (yet?) available or unspecified, not writing
vprp header.

Video stream: 8299.826 kbit/s  (1037478 B/s)  size: 179034171 bytes 
172.567 secs  5181 frames

Audio stream:  134.242 kbit/s  (16780 B/s)  size: 2895679 bytes 
172.565 secs

我尝试了几种不同的方法。我尝试了 -oac copy 和 -oac faac,但每次都得到相同的结果。

有什么建议吗?

答案1

1. 获取ffmpeg

下载静态构建ffmpeg或者编译ffmpeg。repo 中的版本是假的(在 14.04 中被删除),并且没有连接解复用器

2. 创建一个列出输入的文本文件

假设所有 .AVI 输入都在当前目录中。所有文件必须具有相同的流(相同的编解码器、相同的时间基准等)。

printf "file '%s'\n" ./*.AVI > mylist.txt

3. 运行ffmpeg

./ffmpeg -f concat -i mylist.txt -c copy output.avi

如果您使用静态构建,请不要忘记使用./ffmpeg如上例中的方法,或者使用新版本的完整路径ffmpeg或系统版本。

更多信息

相关内容