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 AVCodecParameters *par = s->streams[0]->codecpar;
66 int64_t file_size = avio_tell(pb);
67 uint64_t sample_count = (file_size - 36) / par->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"),
118 .extensions = "drc,vc2",
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,
197 AVOutputFormat ff_gsm_muxer = {
199 .long_name = NULL_IF_CONFIG_SMALL("raw GSM"),
200 .mime_type = "audio/x-gsm",
202 .audio_codec = AV_CODEC_ID_GSM,
203 .video_codec = AV_CODEC_ID_NONE,
204 .write_header = force_one_stream,
205 .write_packet = ff_raw_write_packet,
206 .flags = AVFMT_NOTIMESTAMPS,
210 #if CONFIG_H261_MUXER
211 AVOutputFormat ff_h261_muxer = {
213 .long_name = NULL_IF_CONFIG_SMALL("raw H.261"),
214 .mime_type = "video/x-h261",
215 .extensions = "h261",
216 .audio_codec = AV_CODEC_ID_NONE,
217 .video_codec = AV_CODEC_ID_H261,
218 .write_header = force_one_stream,
219 .write_packet = ff_raw_write_packet,
220 .flags = AVFMT_NOTIMESTAMPS,
224 #if CONFIG_H263_MUXER
225 AVOutputFormat ff_h263_muxer = {
227 .long_name = NULL_IF_CONFIG_SMALL("raw H.263"),
228 .mime_type = "video/x-h263",
229 .extensions = "h263",
230 .audio_codec = AV_CODEC_ID_NONE,
231 .video_codec = AV_CODEC_ID_H263,
232 .write_header = force_one_stream,
233 .write_packet = ff_raw_write_packet,
234 .flags = AVFMT_NOTIMESTAMPS,
238 #if CONFIG_H264_MUXER
239 AVOutputFormat ff_h264_muxer = {
241 .long_name = NULL_IF_CONFIG_SMALL("raw H.264 video"),
242 .extensions = "h264,264",
243 .audio_codec = AV_CODEC_ID_NONE,
244 .video_codec = AV_CODEC_ID_H264,
245 .write_header = force_one_stream,
246 .write_packet = ff_raw_write_packet,
247 .flags = AVFMT_NOTIMESTAMPS,
251 #if CONFIG_HEVC_MUXER
252 AVOutputFormat ff_hevc_muxer = {
254 .long_name = NULL_IF_CONFIG_SMALL("raw HEVC video"),
255 .extensions = "hevc,h265,265",
256 .audio_codec = AV_CODEC_ID_NONE,
257 .video_codec = AV_CODEC_ID_HEVC,
258 .write_header = force_one_stream,
259 .write_packet = ff_raw_write_packet,
260 .flags = AVFMT_NOTIMESTAMPS,
265 AVOutputFormat ff_m4v_muxer = {
267 .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-4 video"),
269 .audio_codec = AV_CODEC_ID_NONE,
270 .video_codec = AV_CODEC_ID_MPEG4,
271 .write_header = force_one_stream,
272 .write_packet = ff_raw_write_packet,
273 .flags = AVFMT_NOTIMESTAMPS,
277 #if CONFIG_MJPEG_MUXER
278 AVOutputFormat ff_mjpeg_muxer = {
280 .long_name = NULL_IF_CONFIG_SMALL("raw MJPEG video"),
281 .mime_type = "video/x-mjpeg",
282 .extensions = "mjpg,mjpeg",
283 .audio_codec = AV_CODEC_ID_NONE,
284 .video_codec = AV_CODEC_ID_MJPEG,
285 .write_header = force_one_stream,
286 .write_packet = ff_raw_write_packet,
287 .flags = AVFMT_NOTIMESTAMPS,
291 #if CONFIG_SINGLEJPEG_MUXER
292 AVOutputFormat ff_singlejpeg_muxer = {
293 .name = "singlejpeg",
294 .long_name = NULL_IF_CONFIG_SMALL("JPEG single image"),
295 .mime_type = "image/jpeg",
296 .audio_codec = AV_CODEC_ID_NONE,
297 .video_codec = AV_CODEC_ID_MJPEG,
298 .write_packet = ff_raw_write_packet,
299 .flags = AVFMT_NOTIMESTAMPS,
300 .write_header = force_one_stream,
305 AVOutputFormat ff_mlp_muxer = {
307 .long_name = NULL_IF_CONFIG_SMALL("raw MLP"),
309 .audio_codec = AV_CODEC_ID_MLP,
310 .video_codec = AV_CODEC_ID_NONE,
311 .write_header = force_one_stream,
312 .write_packet = ff_raw_write_packet,
313 .flags = AVFMT_NOTIMESTAMPS,
317 #if CONFIG_MPEG1VIDEO_MUXER
318 AVOutputFormat ff_mpeg1video_muxer = {
319 .name = "mpeg1video",
320 .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
321 .mime_type = "video/mpeg",
322 .extensions = "mpg,mpeg,m1v",
323 .audio_codec = AV_CODEC_ID_NONE,
324 .video_codec = AV_CODEC_ID_MPEG1VIDEO,
325 .write_header = force_one_stream,
326 .write_packet = ff_raw_write_packet,
327 .flags = AVFMT_NOTIMESTAMPS,
331 #if CONFIG_MPEG2VIDEO_MUXER
332 AVOutputFormat ff_mpeg2video_muxer = {
333 .name = "mpeg2video",
334 .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
336 .audio_codec = AV_CODEC_ID_NONE,
337 .video_codec = AV_CODEC_ID_MPEG2VIDEO,
338 .write_header = force_one_stream,
339 .write_packet = ff_raw_write_packet,
340 .flags = AVFMT_NOTIMESTAMPS,
344 #if CONFIG_RAWVIDEO_MUXER
345 AVOutputFormat ff_rawvideo_muxer = {
347 .long_name = NULL_IF_CONFIG_SMALL("raw video"),
348 .extensions = "yuv,rgb",
349 .audio_codec = AV_CODEC_ID_NONE,
350 .video_codec = AV_CODEC_ID_RAWVIDEO,
351 .write_packet = ff_raw_write_packet,
352 .flags = AVFMT_NOTIMESTAMPS,
356 #if CONFIG_TRUEHD_MUXER
357 AVOutputFormat ff_truehd_muxer = {
359 .long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"),
361 .audio_codec = AV_CODEC_ID_TRUEHD,
362 .video_codec = AV_CODEC_ID_NONE,
363 .write_header = force_one_stream,
364 .write_packet = ff_raw_write_packet,
365 .flags = AVFMT_NOTIMESTAMPS,
370 AVOutputFormat ff_vc1_muxer = {
372 .long_name = NULL_IF_CONFIG_SMALL("raw VC-1 video"),
374 .audio_codec = AV_CODEC_ID_NONE,
375 .video_codec = AV_CODEC_ID_VC1,
376 .write_header = force_one_stream,
377 .write_packet = ff_raw_write_packet,
378 .flags = AVFMT_NOTIMESTAMPS,