3 * Copyright (c) 2001 Fabrice Bellard
4 * Copyright (c) 2005 Alex Beregszaszi
6 * This file is part of FFmpeg.
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt)
28 avio_write(s->pb, pkt->data, pkt->size);
32 static int force_one_stream(AVFormatContext *s)
34 if (s->nb_streams != 1) {
35 av_log(s, AV_LOG_ERROR, "%s files have exactly one stream\n",
37 return AVERROR(EINVAL);
42 /* Note: Do not forget to add new entries to the Makefile as well. */
45 AVOutputFormat ff_ac3_muxer = {
47 .long_name = NULL_IF_CONFIG_SMALL("raw AC-3"),
48 .mime_type = "audio/x-ac3",
50 .audio_codec = AV_CODEC_ID_AC3,
51 .video_codec = AV_CODEC_ID_NONE,
52 .write_header = force_one_stream,
53 .write_packet = ff_raw_write_packet,
54 .flags = AVFMT_NOTIMESTAMPS,
60 static int adx_write_trailer(AVFormatContext *s)
62 AVIOContext *pb = s->pb;
63 AVCodecContext *avctx = s->streams[0]->codec;
66 int64_t file_size = avio_tell(pb);
67 uint64_t sample_count = (file_size - 36) / avctx->channels / 18 * 32;
68 if (sample_count <= UINT32_MAX) {
69 avio_seek(pb, 12, SEEK_SET);
70 avio_wb32(pb, sample_count);
71 avio_seek(pb, file_size, SEEK_SET);
78 AVOutputFormat ff_adx_muxer = {
80 .long_name = NULL_IF_CONFIG_SMALL("CRI ADX"),
82 .audio_codec = AV_CODEC_ID_ADPCM_ADX,
83 .video_codec = AV_CODEC_ID_NONE,
84 .write_header = force_one_stream,
85 .write_packet = ff_raw_write_packet,
86 .write_trailer = adx_write_trailer,
87 .flags = AVFMT_NOTIMESTAMPS,
91 #if CONFIG_CAVSVIDEO_MUXER
92 AVOutputFormat ff_cavsvideo_muxer = {
94 .long_name = NULL_IF_CONFIG_SMALL("raw Chinese AVS (Audio Video Standard) video"),
96 .audio_codec = AV_CODEC_ID_NONE,
97 .video_codec = AV_CODEC_ID_CAVS,
98 .write_header = force_one_stream,
99 .write_packet = ff_raw_write_packet,
100 .flags = AVFMT_NOTIMESTAMPS,
104 #if CONFIG_DATA_MUXER
105 AVOutputFormat ff_data_muxer = {
107 .long_name = NULL_IF_CONFIG_SMALL("raw data"),
108 .write_header = force_one_stream,
109 .write_packet = ff_raw_write_packet,
110 .flags = AVFMT_NOTIMESTAMPS,
114 #if CONFIG_DIRAC_MUXER
115 AVOutputFormat ff_dirac_muxer = {
117 .long_name = NULL_IF_CONFIG_SMALL("raw Dirac"),
119 .audio_codec = AV_CODEC_ID_NONE,
120 .video_codec = AV_CODEC_ID_DIRAC,
121 .write_header = force_one_stream,
122 .write_packet = ff_raw_write_packet,
123 .flags = AVFMT_NOTIMESTAMPS,
127 #if CONFIG_DNXHD_MUXER
128 AVOutputFormat ff_dnxhd_muxer = {
130 .long_name = NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
131 .extensions = "dnxhd",
132 .audio_codec = AV_CODEC_ID_NONE,
133 .video_codec = AV_CODEC_ID_DNXHD,
134 .write_header = force_one_stream,
135 .write_packet = ff_raw_write_packet,
136 .flags = AVFMT_NOTIMESTAMPS,
141 AVOutputFormat ff_dts_muxer = {
143 .long_name = NULL_IF_CONFIG_SMALL("raw DTS"),
144 .mime_type = "audio/x-dca",
146 .audio_codec = AV_CODEC_ID_DTS,
147 .video_codec = AV_CODEC_ID_NONE,
148 .write_header = force_one_stream,
149 .write_packet = ff_raw_write_packet,
150 .flags = AVFMT_NOTIMESTAMPS,
154 #if CONFIG_EAC3_MUXER
155 AVOutputFormat ff_eac3_muxer = {
157 .long_name = NULL_IF_CONFIG_SMALL("raw E-AC-3"),
158 .mime_type = "audio/x-eac3",
159 .extensions = "eac3",
160 .audio_codec = AV_CODEC_ID_EAC3,
161 .video_codec = AV_CODEC_ID_NONE,
162 .write_header = force_one_stream,
163 .write_packet = ff_raw_write_packet,
164 .flags = AVFMT_NOTIMESTAMPS,
168 #if CONFIG_G722_MUXER
169 AVOutputFormat ff_g722_muxer = {
171 .long_name = NULL_IF_CONFIG_SMALL("raw G.722"),
172 .mime_type = "audio/G722",
173 .extensions = "g722",
174 .audio_codec = AV_CODEC_ID_ADPCM_G722,
175 .video_codec = AV_CODEC_ID_NONE,
176 .write_header = force_one_stream,
177 .write_packet = ff_raw_write_packet,
178 .flags = AVFMT_NOTIMESTAMPS,
182 #if CONFIG_G723_1_MUXER
183 AVOutputFormat ff_g723_1_muxer = {
185 .long_name = NULL_IF_CONFIG_SMALL("raw G.723.1"),
186 .mime_type = "audio/g723",
187 .extensions = "tco,rco",
188 .audio_codec = AV_CODEC_ID_G723_1,
189 .video_codec = AV_CODEC_ID_NONE,
190 .write_header = force_one_stream,
191 .write_packet = ff_raw_write_packet,
192 .flags = AVFMT_NOTIMESTAMPS,
196 #if CONFIG_H261_MUXER
197 AVOutputFormat ff_h261_muxer = {
199 .long_name = NULL_IF_CONFIG_SMALL("raw H.261"),
200 .mime_type = "video/x-h261",
201 .extensions = "h261",
202 .audio_codec = AV_CODEC_ID_NONE,
203 .video_codec = AV_CODEC_ID_H261,
204 .write_header = force_one_stream,
205 .write_packet = ff_raw_write_packet,
206 .flags = AVFMT_NOTIMESTAMPS,
210 #if CONFIG_H263_MUXER
211 AVOutputFormat ff_h263_muxer = {
213 .long_name = NULL_IF_CONFIG_SMALL("raw H.263"),
214 .mime_type = "video/x-h263",
215 .extensions = "h263",
216 .audio_codec = AV_CODEC_ID_NONE,
217 .video_codec = AV_CODEC_ID_H263,
218 .write_header = force_one_stream,
219 .write_packet = ff_raw_write_packet,
220 .flags = AVFMT_NOTIMESTAMPS,
224 #if CONFIG_H264_MUXER
225 AVOutputFormat ff_h264_muxer = {
227 .long_name = NULL_IF_CONFIG_SMALL("raw H.264 video"),
228 .extensions = "h264,264",
229 .audio_codec = AV_CODEC_ID_NONE,
230 .video_codec = AV_CODEC_ID_H264,
231 .write_header = force_one_stream,
232 .write_packet = ff_raw_write_packet,
233 .flags = AVFMT_NOTIMESTAMPS,
237 #if CONFIG_HEVC_MUXER
238 AVOutputFormat ff_hevc_muxer = {
240 .long_name = NULL_IF_CONFIG_SMALL("raw HEVC video"),
241 .extensions = "hevc,h265,265",
242 .audio_codec = AV_CODEC_ID_NONE,
243 .video_codec = AV_CODEC_ID_HEVC,
244 .write_header = force_one_stream,
245 .write_packet = ff_raw_write_packet,
246 .flags = AVFMT_NOTIMESTAMPS,
251 AVOutputFormat ff_m4v_muxer = {
253 .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-4 video"),
255 .audio_codec = AV_CODEC_ID_NONE,
256 .video_codec = AV_CODEC_ID_MPEG4,
257 .write_header = force_one_stream,
258 .write_packet = ff_raw_write_packet,
259 .flags = AVFMT_NOTIMESTAMPS,
263 #if CONFIG_MJPEG_MUXER
264 AVOutputFormat ff_mjpeg_muxer = {
266 .long_name = NULL_IF_CONFIG_SMALL("raw MJPEG video"),
267 .mime_type = "video/x-mjpeg",
268 .extensions = "mjpg,mjpeg",
269 .audio_codec = AV_CODEC_ID_NONE,
270 .video_codec = AV_CODEC_ID_MJPEG,
271 .write_header = force_one_stream,
272 .write_packet = ff_raw_write_packet,
273 .flags = AVFMT_NOTIMESTAMPS,
277 #if CONFIG_SINGLEJPEG_MUXER
278 AVOutputFormat ff_singlejpeg_muxer = {
279 .name = "singlejpeg",
280 .long_name = NULL_IF_CONFIG_SMALL("JPEG single image"),
281 .mime_type = "image/jpeg",
282 .audio_codec = AV_CODEC_ID_NONE,
283 .video_codec = AV_CODEC_ID_MJPEG,
284 .write_packet = ff_raw_write_packet,
285 .flags = AVFMT_NOTIMESTAMPS,
286 .write_header = force_one_stream,
291 AVOutputFormat ff_mlp_muxer = {
293 .long_name = NULL_IF_CONFIG_SMALL("raw MLP"),
295 .audio_codec = AV_CODEC_ID_MLP,
296 .video_codec = AV_CODEC_ID_NONE,
297 .write_header = force_one_stream,
298 .write_packet = ff_raw_write_packet,
299 .flags = AVFMT_NOTIMESTAMPS,
303 #if CONFIG_MPEG1VIDEO_MUXER
304 AVOutputFormat ff_mpeg1video_muxer = {
305 .name = "mpeg1video",
306 .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
307 .mime_type = "video/mpeg",
308 .extensions = "mpg,mpeg,m1v",
309 .audio_codec = AV_CODEC_ID_NONE,
310 .video_codec = AV_CODEC_ID_MPEG1VIDEO,
311 .write_header = force_one_stream,
312 .write_packet = ff_raw_write_packet,
313 .flags = AVFMT_NOTIMESTAMPS,
317 #if CONFIG_MPEG2VIDEO_MUXER
318 AVOutputFormat ff_mpeg2video_muxer = {
319 .name = "mpeg2video",
320 .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
322 .audio_codec = AV_CODEC_ID_NONE,
323 .video_codec = AV_CODEC_ID_MPEG2VIDEO,
324 .write_header = force_one_stream,
325 .write_packet = ff_raw_write_packet,
326 .flags = AVFMT_NOTIMESTAMPS,
330 #if CONFIG_RAWVIDEO_MUXER
331 AVOutputFormat ff_rawvideo_muxer = {
333 .long_name = NULL_IF_CONFIG_SMALL("raw video"),
334 .extensions = "yuv,rgb",
335 .audio_codec = AV_CODEC_ID_NONE,
336 .video_codec = AV_CODEC_ID_RAWVIDEO,
337 .write_packet = ff_raw_write_packet,
338 .flags = AVFMT_NOTIMESTAMPS,
342 #if CONFIG_TRUEHD_MUXER
343 AVOutputFormat ff_truehd_muxer = {
345 .long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"),
347 .audio_codec = AV_CODEC_ID_TRUEHD,
348 .video_codec = AV_CODEC_ID_NONE,
349 .write_header = force_one_stream,
350 .write_packet = ff_raw_write_packet,
351 .flags = AVFMT_NOTIMESTAMPS,
356 AVOutputFormat ff_vc1_muxer = {
358 .long_name = NULL_IF_CONFIG_SMALL("raw VC-1 video"),
360 .audio_codec = AV_CODEC_ID_NONE,
361 .video_codec = AV_CODEC_ID_VC1,
362 .write_header = force_one_stream,
363 .write_packet = ff_raw_write_packet,
364 .flags = AVFMT_NOTIMESTAMPS,