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

Luca Abeni lucabe72
Tue Jun 12 08:39:49 CEST 2007

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.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: reset_disable_on_new_file_1.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070612/ba946cde/attachment.txt>

More information about the ffmpeg-devel mailing list