[FFmpeg-devel] [PATCH] Reset audio_disable and video_disable for new input files

Michael Niedermayer michaelni
Tue Jun 12 09:23:03 CEST 2007


Hi

On Tue, Jun 12, 2007 at 08:39:49AM +0200, Luca Abeni wrote:
> Hi Michael,
> 
> Michael Niedermayer wrote:
> [...]
> >>The only way I found to do this is
> >>ffmpeg -i input.avi -vcodec copy -an out1.avi -i input.avi -acodec copy 
> >>-vn out2.avi
> >>but this unfortunately fails, because when the second input is read 
> >>audio_disable is not reset to 0. Is this done by purpose? If not, the 
> >>attached patch fixes the problem.
> >[...]
> >>Index: ffmpeg/ffmpeg.c
> >>===================================================================
> >>--- ffmpeg.orig/ffmpeg.c	2007-06-11 12:48:41.000000000 +0200
> >>+++ ffmpeg/ffmpeg.c	2007-06-11 12:49:29.000000000 +0200
> >>@@ -2662,6 +2662,9 @@
> >>     video_channel = 0;
> >> 
> >>     rate_emu = 0;
> >>+
> >>+    audio_disable = 0;
> >>+    video_disable = 0;
> >> }
> >
> >i dont think this will be enough because *_disable is used prior to that
> >to set AVStream.discard
> Uhmm... I did not notice that those variables were used to set 
> AVStream.discard... So, are "-vn" and "-an" supposed to disable audio 
> and video in the input file (that is, the stream is discarded from the 
> input) or in the output file (that is, the audio or video stream is not 
> created in the output)?
> 
> Currently, they seem to disable video or audio in both the input and the 
> output file.
> 
> In my example, I was trying to disable the video or audio stream in the 
> output file. This is probably why my patch worked for me (using the 
> command line cited above).
> 
> Anyway, I now see that my original patch was wrong; here is a better 
> one. The problem in current code is that it tries to reset *_disable to 
> 0, but it does it in new_video_stream() (and new_audio_stream()), which 
> are not called if video_disable (or audio_disable) is != 0. So, 
> *_disable is never reset to 0. The attached patch fixes the problem.

wont that break -newvideo with -vn ?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070612/7f7c0018/attachment.pgp>



More information about the ffmpeg-devel mailing list