Wie können Sie einen Teil einer mit xvid codierten Avi-Datei mit ffmpeg ausspleißen? (keine Probleme mit anderen Dateien)

2593
user11955

Ich benutze den folgenden Befehl, der für die meisten Dateien funktioniert, mit Ausnahme der scheinbar xvid-codierten

/usr/bin/ffmpeg -sameq -i file.avi -ss 00:01:00 -t 00:00:30 -ac 2 -r 25 -copyts output.avi 

Dies sollte also im Wesentlichen 30 Sekunden Video + Audio ausspalten, beginnend mit einer Minute Minute.

Es beginnt mit der Kodierung bei der 00:01:00-Marke, aber es geht aus irgendeinem Grund bis zum Ende der Datei und ignoriert, dass ich nur 30 Sekunden will.

Die Ausgabe sieht so aus.

FFmpeg version git-ecc4bdd, Copyright (c) 2000-2010 the FFmpeg developers built on May 31 2010 04:52:24 with gcc 4.4.3 20100127 (Red Hat 4.4.3-4) configuration: --enable-libx264 --enable-libxvid --enable-libmp3lame --enable-libopenjpeg --enable-libfaac --enable-libvorbis --enable-gpl --enable-nonfree --enable-libxvid --enable-pthreads --enable-libfaad --extra-cflags=-fPIC --enable-postproc --enable-libtheora --enable-libvorbis --enable-shared libavutil 50.15. 2 / 50.15. 2 libavcodec 52.67. 0 / 52.67. 0 libavformat 52.62. 0 / 52.62. 0 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1.20. 0 / 1.20. 0 libswscale 0.10. 0 / 0.10. 0 libpostproc 51. 2. 0 / 51. 2. 0 [mpeg4 @ 0x17cf770]Invalid and inefficient vfw-avi packed B frames detected Input #0, avi, from 'file.avi': Metadata: ISFT : VirtualDubMod 1.5.10.2 (build 2540/release) Duration: 00:02:00.00, start: 0.000000, bitrate: 1587 kb/s Stream #0.0: Video: mpeg4, yuv420p, 672x368 [PAR 1:1 DAR 42:23], 25 tbr, 25 tbn, 25 tbc Stream #0.1: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s File 'lol6.avi' already exists. Overwrite ? [y/N] y Output #0, avi, to 'lol6.avi': Metadata: ISFT : Lavf52.62.0 Stream #0.0: Video: mpeg4, yuv420p, 672x368 [PAR 1:1 DAR 42:23], q=2-31, 200 kb/s, 25 tbn, 25 tbc Stream #0.1: Audio: mp2, 48000 Hz, 2 channels, s16, 64 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1 Press [q] to stop encoding [mpeg4 @ 0x17cf770]Invalid and inefficient vfw-avi packed B frames detected [buffer @ 0x184b610]Buffering several frames is not supported. Please consume all available frames before adding a new one. frame= 1501 fps=104 q=0.0 Lsize= 15612kB time=30.02 bitrate=4259.7kbits/s ts/s video:15303kB audio:235kB global headers:0kB muxing overhead 0.482620% 

Wenn ich diese Datei zum Beispiel in mp4 konvertiere und dann dieselbe Aktion durchführe, funktioniert das einwandfrei.

4
Bist du unter Windows? Wenn ja, kann ich einen anderen Weg empfehlen. (oops, nein, Sie sind es nicht. Ich sehe oben / / usr / bin.) Entschuldigung. :( Pretzel vor 13 Jahren 0
Kannst du das AVI irgendwo posten, damit ich deinen Fehler reproduzieren und beheben kann? whitequark vor 13 Jahren 0

2 Antworten auf die Frage

2
quack quixote

I presume your "convert to MP4" operation is just a container change, not a full re-encode of the A/V data streams. So perhaps FFmpeg is getting hung up on something broken in those AVI containers. This line in your output might support this:

[mpeg4 @ 0x17cf770]Invalid and inefficient vfw-avi packed B frames detected

You could try creating a new AVI container -- let FFmpeg copy the entire file, eg with:

ffmpeg -i input.avi -vcodec copy -acodec copy output.avi 

This should create a new AVI container and copy the data streams. Then try your command again. If it works, you've got broken AVIs (or possibly an FFmpeg bug) -- either way, you can put all your videos into new AVI containers and get it done that way.

If that doesn't work, you might look further into the broken XviDs and see what they have in common.

Nein, es ist eine vollständige Umcodierung in ein iPhone-kompatibles Format. Und die Datei selbst ist in Ordnung. Es passiert mit jeder xvid-kodierten Datei (ich habe bisher 3 versucht). Es wurde versucht, eine neue Datei zu erstellen, die auf Ihrem Code basiert (keine Auswirkung), und der Fehler ist immer noch vorhanden. user11955 vor 13 Jahren 0
Versuchen Sie, mit einigen Personen in #ffmpeg @ FreeNode zu sprechen. Nitrodist vor 13 Jahren 0
für mich gearbeitet danken! teslasimus vor 11 Jahren 0
1
harrymc

I wonder if your problem is the same as in this article:
Convert any video file for an iPod or iPhone

You want to use your fancy new Apple iPod Video or Apple iPhone, but you don't know how to convert video so it will play.

Ubuntu 9.10 (Karmic Koala) ships with a version of ffmpeg without libfaac support because of licensing issues. This means you will need to compile ffmpeg yourself. This guide explains how.

The article explains, step-by-step, how to compile ffmpeg by hand or create a modified ffmpeg package, that includes libfaac to support Advanced Audio Coding (AAC).