Merge commit '9e6b5e61a0c91e25e298d0a21b189c4c95443795'
* commit '9e6b5e61a0c91e25e298d0a21b189c4c95443795': img2enc: add an option for overwriting one file with subsequent images Conflicts: doc/muxers.texi libavformat/img2enc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		
						commit
						647fe2e777
					
				| @ -245,9 +245,11 @@ ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg | |||||||
| Start the sequence from @var{number}. Default value is 1. Must be a | Start the sequence from @var{number}. Default value is 1. Must be a | ||||||
| positive number. | positive number. | ||||||
| 
 | 
 | ||||||
| @item updatefirst 1|0 | @item -update @var{number} | ||||||
| If set to 1, update the first written image file again and | If @var{number} is nonzero, the filename will always be interpreted as just a | ||||||
| again. Default value is 0. | filename, not a pattern, and this file will be continuously overwritten with new | ||||||
|  | images. | ||||||
|  | 
 | ||||||
| @end table | @end table | ||||||
| 
 | 
 | ||||||
| The image muxer supports the .Y.U.V image file format. This format is | The image muxer supports the .Y.U.V image file format. This format is | ||||||
|  | |||||||
| @ -36,7 +36,7 @@ typedef struct { | |||||||
|     int is_pipe; |     int is_pipe; | ||||||
|     int split_planes;       /**< use independent file for each Y, U, V plane */ |     int split_planes;       /**< use independent file for each Y, U, V plane */ | ||||||
|     char path[1024]; |     char path[1024]; | ||||||
|     int updatefirst; |     int update; | ||||||
| } VideoMuxData; | } VideoMuxData; | ||||||
| 
 | 
 | ||||||
| static int write_header(AVFormatContext *s) | static int write_header(AVFormatContext *s) | ||||||
| @ -75,8 +75,10 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) | |||||||
|     int i; |     int i; | ||||||
| 
 | 
 | ||||||
|     if (!img->is_pipe) { |     if (!img->is_pipe) { | ||||||
|         if (av_get_frame_filename(filename, sizeof(filename), |         if (img->update) { | ||||||
|                                   img->path, img->img_number) < 0 && img->img_number > 1 && !img->updatefirst) { |             av_strlcpy(filename, img->path, sizeof(filename)); | ||||||
|  |         } else if (av_get_frame_filename(filename, sizeof(filename), img->path, img->img_number) < 0 && | ||||||
|  |                    img->img_number > 1) { | ||||||
|             av_log(s, AV_LOG_ERROR, |             av_log(s, AV_LOG_ERROR, | ||||||
|                    "Could not get frame filename number %d from pattern '%s' (either set updatefirst or use a pattern like %%03d within the filename pattern)\n", |                    "Could not get frame filename number %d from pattern '%s' (either set updatefirst or use a pattern like %%03d within the filename pattern)\n", | ||||||
|                    img->img_number, img->path); |                    img->img_number, img->path); | ||||||
| @ -128,7 +130,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) | |||||||
| #define OFFSET(x) offsetof(VideoMuxData, x) | #define OFFSET(x) offsetof(VideoMuxData, x) | ||||||
| #define ENC AV_OPT_FLAG_ENCODING_PARAM | #define ENC AV_OPT_FLAG_ENCODING_PARAM | ||||||
| static const AVOption muxoptions[] = { | static const AVOption muxoptions[] = { | ||||||
|     { "updatefirst",  "update the first image file",      OFFSET(updatefirst), AV_OPT_TYPE_INT, { .i64 = 0 }, 0,       1, ENC }, |     { "updatefirst",  "continuously overwrite one file", OFFSET(update),  AV_OPT_TYPE_INT, { .i64 = 0 }, 0,       1, ENC }, | ||||||
|  |     { "update",       "continuously overwrite one file", OFFSET(update),  AV_OPT_TYPE_INT, { .i64 = 0 }, 0,       1, ENC }, | ||||||
|     { "start_number", "set first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT,  { .i64 = 1 }, 1, INT_MAX, ENC }, |     { "start_number", "set first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT,  { .i64 = 1 }, 1, INT_MAX, ENC }, | ||||||
|     { NULL }, |     { NULL }, | ||||||
| }; | }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user