Commit Graph

100 Commits

Author SHA1 Message Date
Sam Hocevar 3115550abe doc/examples/muxing: Fix av_frame_make_writable usage
This patch moves the av_frame_make_writable() call from fill_yuv_image
to get_video_frame so that its argument can be the actual frame that
will be sent to the encoder.

This fixes data corruption issues in codecs that keep references on
one or several previous frames.

Signed-off-by: Sam Hocevar <sam@hocevar.net>
Reviewed-by: wm4
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-23 03:28:04 +01:00
Clément Bœsch 8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Michael Niedermayer 0c79c96cf2 doc/examples/muxing: Add support to pass flags to muxer as since codecpar the codec flags are not available to the muxer anymore
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-11 17:57:06 +02:00
Derek Buitenhuis d76972b581 Merge commit '9897d9f4e074cdc6c7f2409885ddefe300f18dc7'
* commit '9897d9f4e074cdc6c7f2409885ddefe300f18dc7':
  examples/output: convert to codecpar

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-11 14:06:43 +01:00
Michael Niedermayer 83fc0b9d48 doc/examples/muxing: Fix mixed declaration and code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-15 00:24:00 +02:00
Hendrik Leppkes 1899b25799 Merge commit '34ed5c2e4d9b7fe5c9b3aae2da5599fabb95c02e'
* commit '34ed5c2e4d9b7fe5c9b3aae2da5599fabb95c02e':
  avformat: Do not use AVFMT_RAWPICTURE

Removal from ffmpeg.c not merged because some parts of avdevice
still use it

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-14 14:43:20 +02:00
Michael Niedermayer 444e9874a7 Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'
* commit 'def97856de6021965db86c25a732d78689bd6bb0':
  lavc: AV-prefix all codec capabilities

Conflicts:
	cmdutils.c
	ffmpeg.c
	ffplay.c
	libavcodec/8svx.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/adpcm.c
	libavcodec/alac.c
	libavcodec/atrac3plusdec.c
	libavcodec/bink.c
	libavcodec/dnxhddec.c
	libavcodec/dvdec.c
	libavcodec/dvenc.c
	libavcodec/ffv1dec.c
	libavcodec/ffv1enc.c
	libavcodec/fic.c
	libavcodec/flacdec.c
	libavcodec/flacenc.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/hevc.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopenjpegdec.c
	libavcodec/libvo-aacenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxdec.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpegaudiodec_float.c
	libavcodec/msmpeg4dec.c
	libavcodec/mxpegdec.c
	libavcodec/nvenc_h264.c
	libavcodec/nvenc_hevc.c
	libavcodec/pngdec.c
	libavcodec/qpeg.c
	libavcodec/ra288.c
	libavcodec/rv10.c
	libavcodec/s302m.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tiff.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/vp9.c
	libavcodec/wavpack.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:50:18 +02:00
Michael Niedermayer 94d68a41fa Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'
* commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615':
  lavc: AV-prefix all codec flags

Conflicts:
	doc/examples/muxing.c
	ffmpeg.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/ac3enc_float.c
	libavcodec/atrac1.c
	libavcodec/atrac3.c
	libavcodec/atrac3plusdec.c
	libavcodec/dcadec.c
	libavcodec/ffv1enc.c
	libavcodec/h264.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_mb.c
	libavcodec/imc.c
	libavcodec/libmp3lame.c
	libavcodec/libtheoraenc.c
	libavcodec/libtwolame.c
	libavcodec/libvpxenc.c
	libavcodec/libxavs.c
	libavcodec/libxvid.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg12enc.c
	libavcodec/mpegaudiodec_template.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/nellymoserdec.c
	libavcodec/nellymoserenc.c
	libavcodec/nvenc.c
	libavcodec/on2avc.c
	libavcodec/options_table.h
	libavcodec/opus_celt.c
	libavcodec/pngenc.c
	libavcodec/ra288.c
	libavcodec/ratecontrol.c
	libavcodec/twinvq.c
	libavcodec/vc1_block.c
	libavcodec/vc1_loopfilter.c
	libavcodec/vc1_mc.c
	libavcodec/vc1dec.c
	libavcodec/vorbisdec.c
	libavcodec/vp3.c
	libavcodec/wma.c
	libavcodec/wmaprodec.c
	libavcodec/x86/hpeldsp_init.c
	libavcodec/x86/me_cmp_init.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:10:35 +02:00
Michael Niedermayer 1d2410639d doc/examples/muxing: Use avio_closep() in examples as it avoids leaving stale pointers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-08 05:28:15 +01:00
Michael Niedermayer f285056810 doc/examples/muxing: fix "-flags" option
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-27 19:58:47 +02:00
Michael Niedermayer c437765be7 doc/examples/muxing: Exchange tmp_frame and frame
Reduces difference to 56f98e340f

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-27 12:03:51 +02:00
Michael Niedermayer d1ce43a3e8 doc/examples/muxing: mark correct frame as writeable
Bug found from comparing 56f98e340f to HEAD
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-27 01:55:17 +02:00
Michael Niedermayer fbd46e2f1c doc/examples/muxing: Always use swr, simplifies code slightly
Idea-from: 56f98e340f
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-27 01:32:19 +02:00
Anton Khirnov 22e9fe06eb doc/examples/muxing: add alloc_audio_frame() and use it to simplify code.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-27 01:15:39 +02:00
Michael Niedermayer a98cadef7f doc/examples/muxing: Move samples_count to OutputStream
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-27 01:05:05 +02:00
Michael Niedermayer 8b1d54ba40 doc/examples/muxing: free swr context at the end
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-27 00:50:58 +02:00
Michael Niedermayer 7cf0865551 doc/examples/muxing: Support setting flags, for example for setting bitexact
This would allow the example to be used in regression tests

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-26 22:49:02 +02:00
Michael Niedermayer 5d2cf1ae86 doc/examples/muxing: select a supported sample rate for the encoder, favor 44100
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-26 22:27:50 +02:00
Michael Niedermayer ead22f42f4 doc/examples/muxing: pick a supported channel layout if stereo isnt supported by the encoder
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-26 22:01:08 +02:00
Michael Niedermayer 9ccb9c8df2 doc/examples/muxing: move swr context to OutputStream
Idea from: 56f98e340f
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-26 21:50:21 +02:00
Michael Niedermayer 1c0c19f8bd Merge commit '884f7c975f0af25febe86660e87bf3b2165a0309'
* commit '884f7c975f0af25febe86660e87bf3b2165a0309':
  output example: set the stream timebase

Conflicts:
	doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-26 21:04:31 +02:00
Michael Niedermayer 4d3072ada3 doc/examples/muxing: remove unused variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-28 21:44:38 +02:00
Michael Niedermayer 8469c73576 Merge commit '182d3f8221c23716ea4eafa460bdb94968f71f26'
* commit '182d3f8221c23716ea4eafa460bdb94968f71f26':
  output example: rewrite encoding logic

Conflicts:
	doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-27 00:57:04 +02:00
Michael Niedermayer 9a2850c26a Merge commit 'a7fcd4122b19b0f934020f4e261d0c44c4c32e11'
* commit 'a7fcd4122b19b0f934020f4e261d0c44c4c32e11':
  output example: store the scaling context in the stream context

Conflicts:
	doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-27 00:16:34 +02:00
Michael Niedermayer 877716a79c Merge commit '6a927d7aaf5625e83a674072913b9e292a303fd1'
* commit '6a927d7aaf5625e83a674072913b9e292a303fd1':
  output example: use a macro instead of a static variable

Conflicts:
	doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-26 23:58:00 +02:00
Michael Niedermayer 5a55d5e445 Merge commit '63fd0d866c8300a8f251a15b1535e9ce40a407fb'
* commit '63fd0d866c8300a8f251a15b1535e9ce40a407fb':
  output example: allocate the audio frame only once

Conflicts:
	doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-26 23:22:08 +02:00
Michael Niedermayer b9bfd888e5 Merge commit 'edd5f957646dcbf1bb55718bc7bf1e5481c25bcb'
* commit 'edd5f957646dcbf1bb55718bc7bf1e5481c25bcb':
  output example: use OutputStream for audio streams as well

Conflicts:
	doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-26 23:01:52 +02:00
Michael Niedermayer 11991a7d90 Merge commit '5e7b125b6ae36893dfd9cb5661c99b67363cbb38'
* commit '5e7b125b6ae36893dfd9cb5661c99b67363cbb38':
  output example: use the new AVFrame API to allocate audio frames

Conflicts:
	doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-26 22:46:11 +02:00
Michael Niedermayer a1c4635558 Merge commit 'ac85f631c9a9cc59aaca1c8dd6894fb1f701c594'
* commit 'ac85f631c9a9cc59aaca1c8dd6894fb1f701c594':
  output example: set output channel layout

Conflicts:
	doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-26 22:13:46 +02:00
Michael Niedermayer 8eb1174a9e Merge commit '294daf71a7a1303b5ddd3cbefebed3b732d610f3'
* commit '294daf71a7a1303b5ddd3cbefebed3b732d610f3':
  output example: use a struct to bundle the video stream variables together

Conflicts:
	doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-26 21:55:11 +02:00
Michael Niedermayer c9083d85df Merge commit '38d044429dabcd28928693240e955c6d4430cca9'
* commit '38d044429dabcd28928693240e955c6d4430cca9':
  output example: use the new AVFrame API for allocating the video frame

Conflicts:
	doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-26 21:30:37 +02:00
Michael Niedermayer afa7ab557a Merge commit '452860d7e056f9a894cac2fe52cdedeae4c38251'
* commit '452860d7e056f9a894cac2fe52cdedeae4c38251':
  Use av_packet_rescale_ts() to simplify code.

Conflicts:
	doc/examples/muxing.c
	ffmpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-20 17:03:58 +02:00
Michael Niedermayer 341639fe80 doc/examples: remove pathes from doxy examples
This makes the examples page less cluttered

Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-17 13:50:53 +01:00
Michael Niedermayer fba1592f35 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  doc/examples: misc Doxygen markup improvements

Conflicts:
	doc/examples/muxing.c
	doc/examples/transcode_aac.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-14 15:31:14 +01:00
Stefano Sabatini 35fe88bb51 examples/muxing: reindent after previous commit 2014-01-23 01:08:24 +01:00
Stefano Sabatini c92d2f98db examples/muxing: flush encoders at the end 2014-01-23 00:54:33 +01:00
Stefano Sabatini e34ad128a3 examples/muxing: reduce duration, remove wrong and misleading comment
Set duration to 10 seconds, after it was increased from 5 to 200 seconds
in 8d80f3cb87.

200 seconds will generate too much data which is annoying especially when
testing.
2014-01-21 11:52:14 +01:00
Stefano Sabatini 9ab8f3738a examples/muxing: remove redundant {} 2014-01-20 13:10:10 +01:00
Stefano Sabatini b933c72b5e examples/muxing: change error checks, from "ret != 0" to "ret < 0"
More consistent and more future-proof.
2014-01-20 13:10:10 +01:00
Stefano Sabatini d72c742d47 examples/muxing: factorize write_interleave code
Also log output packet information.
2014-01-20 13:10:10 +01:00
Stefano Sabatini d497141b85 examples/muxing: simplify video PTS setting
Rely on frame_count. Also more consistent with audio path.
2014-01-12 09:25:48 +01:00
Andre Anjos 23ffc4c70d doc/examples/muxing: Fixes frame initialization.
Fixes use of the example with encoders which use tha AVFrame w/h/pix_fmt fields
FFV1 is one of these codecs

We cannot easily workaround the not set fields in common code because the API
has AVFrame constant for the encoders.
Alternatives would be to fix the API or to duplicate the struct and fill in
missing fields. Or as is to require all user apps to set this correctly and
maybe simplify for that case

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-09 18:12:24 +01:00
Stefano Sabatini 094c500caf examples/muxing: set timestamps in output audio packet
In particular, fix trac ticket #3231.
2014-01-09 10:54:38 +01:00
Stefano Sabatini 8d22d37e54 examples/muxing: use av_frame_free() in place of av_free() 2014-01-09 10:51:57 +01:00
Stefano Sabatini 9abe4a10fd examples/muxing: reuse global audio frame
Simplify logic, avoid multiple unnecessary alloc/free operations.
2014-01-09 10:51:52 +01:00
Stefano Sabatini 80bca6eabe examples/muxing: honour distinction between encoder PTS timebase and stream timebase
Fix PTS set on the frame when encoding, which must be specified in the
encoder timebase or this will confuse the encoder.

When muxing the packet, the PTS/DTS generated by the encoder is then
rescaled to the stream timebase.
2014-01-09 10:51:47 +01:00
Stefano Sabatini eadc421259 examples/muxing: set sample formats from list of codec supported sample formats
Avoid the need of tweaking, also show how to get list of supported sample
formats.
2014-01-09 10:51:41 +01:00
Ilya Basin d1b8e01ef1 examples/muxing: fix memleaks in resampler
- do not allocate resample dst buffer when resample is off
  - free sample buffers in addition to freeing data pointer arrays

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-21 12:22:49 +01:00
Ilya Basin 7d1d0b3ecf examples/muxing: use S16 sample_fmt for resample src regardless of codec sample_fmt
We generate S16 samples and we should allocate the right buffer

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-21 12:21:05 +01:00
Ilya Basin b6714fa077 examples/muxing: fix av_frame_free() not called when got_packet is false
Hi list! Since my last patch (fix 2 memleaks in doc/examples/muxing.c)
I found more problems to fix.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-21 12:20:44 +01:00