Programming/ffmpeg2017. 3. 9. 13:09

av_opt_set() 으로 buffer_size 하려는데 안되길래 버전을 올리니.. 으헉?

1>cmdutils.obj : error LNK2001: _avcodec_default_release_buffer 외부 기호를 확인할 수 없습니다.

1>ffplaycore.obj : error LNK2001: _avcodec_alloc_frame 외부 기호를 확인할 수 없습니다.

1>ffplaycore.obj : error LNK2001: _avcodec_get_frame_defaults 외부 기호를 확인할 수 없습니다.

1>ffplaycore.obj : error LNK2001: _avcodec_free_frame 외부 기호를 확인할 수 없습니다. 



-void avcodec_free_frame(AVFrame **frame)

-{

-    av_frame_free(frame);

-} 

[링크 : https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2015-September/093338.html]



#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 45, 101)

      av_frame_alloc()

#else

    avcodec_alloc_frame()

#endif 

[링크 : https://www.bountysource.com/issues/6093496-replace-avcodec_alloc_frame-with-av_frame_alloc]


-void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)

-{

-    av_frame_unref(pic);

-} 

[링크 : https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2015-September/093320.html


The comment around the function declaration for avcodec_get_frame_defaults says that you should use av_frame_unref and the code seems to be doing just that: 

[링크 : http://stackoverflow.com/questions/27686064/ffmpeg-avcodec-get-frame-defaults-was-declared-deprecated


빌드는 어찌했는데 실행이 안되네 ㅠㅠ

dll 신버전 맞춰줘도 왜 안되니 ㅠㅠ

'Programming > ffmpeg' 카테고리의 다른 글

vlc "network-caching" / ffmpeg "buffer_size" 소스 검색  (0) 2017.03.07
ffplay.c  (0) 2017.03.06
ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
Posted by 구차니
Programming/ffmpeg2017. 3. 7. 19:27

vlc

Search ""network-caching"" (23 hits in 21 files)

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\avio.c (1 hit)

Line 442:         *delay = INT64_C(1000) * var_InheritInteger(access, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\file.c (1 hit)

Line 409:                 *pi_64 = var_InheritInteger (p_access, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\ftp.c (1 hit)

Line 899:                    * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\http.c (1 hit)

Line 995:                 * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\live555.cpp (1 hit)

Line 1683:                   * var_InheritInteger( p_demux, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\mms\mmsh.c (1 hit)

Line 253:                    * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\mms\mmstu.c (1 hit)

Line 257:                    * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\rtp\rtp.c (1 hit)

Line 384:             *v = INT64_C(1000) * var_InheritInteger (demux, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\rtsp\access.c (1 hit)

Line 325:                 * var_InheritInteger(p_access, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\sftp.c (1 hit)

Line 360:                * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\smb.c (1 hit)

Line 329:             * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\tcp.c (1 hit)

Line 178:                    * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\udp.c (1 hit)

Line 220:                    * var_InheritInteger(p_access, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\vnc.c (1 hit)

Line 301:                   * var_InheritInteger( p_demux, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\gui\macosx\simple_prefs.m (2 hits)

Line 761:     TestCaC("network-caching", 10/3);

Line 1074:             CaC("network-caching", 10/3);

  D:\Download\ffmpeg\vlc-2.2.4\modules\gui\qt4\components\open_panels.cpp (1 hit)

Line 705:     emit methodChanged( qfu( "network-caching" ) );

  D:\Download\ffmpeg\vlc-2.2.4\modules\gui\qt4\components\simple_preferences.cpp (2 hits)

Line 728:             TestCaC( "network-caching", 10/3 );

Line 1074:             CaC( "network-caching", 10/3 );

  D:\Download\ffmpeg\vlc-2.2.4\modules\stream_filter\dash\dash.cpp (1 hit)

Line 291:                 var_InheritInteger(p_stream, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\stream_filter\httplive.c (1 hit)

Line 2758:                 var_InheritInteger(s, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\stream_filter\smooth\smooth.c (1 hit)

Line 796:                 var_InheritInteger(s, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\src\libvlc-module.c (1 hit)

Line 1823:     add_integer( "network-caching", CLOCK_FREQ / 1000, 


ffmpeg

Search ""buffer_size"" (7 hits in 5 files)

  D:\Download\ffmpeg\ffmpeg-3.2.4\libavdevice\pulse_audio_enc.c (1 hit)

Line 766:     { "buffer_size",     "set buffer size in bytes",         OFFSET(buffer_size),     AV_OPT_TYPE_INT,    {.i64 = 0}, 0, INT_MAX, E },

  D:\Download\ffmpeg\ffmpeg-3.2.4\libavformat\rtpproto.c (1 hit)

Line 68:     { "buffer_size",        "Send/Receive buffer size (in bytes)",                              OFFSET(buffer_size),     AV_OPT_TYPE_INT,    { .i64 = -1 },    -1, INT_MAX, .flags = D|E },

  D:\Download\ffmpeg\ffmpeg-3.2.4\libavformat\rtsp.c (2 hits)

Line 79:     { "buffer_size",        "Underlying protocol send/receive buffer size",                  OFFSET(buffer_size),           AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC } \

Line 125:     av_dict_set(&opts, "buffer_size", buf, 0);

  D:\Download\ffmpeg\ffmpeg-3.2.4\libavformat\rtspdec.c (1 hit)

Line 294:             av_dict_set(&opts, "buffer_size", buf, 0);

  D:\Download\ffmpeg\ffmpeg-3.2.4\libavformat\udp.c (2 hits)

Line 122:     { "buffer_size",    "System data size (in bytes)",                     OFFSET(buffer_size),    AV_OPT_TYPE_INT,    { .i64 = -1 },    -1, INT_MAX, .flags = D|E },

Line 750:         if (av_find_info_tag(buf, sizeof(buf), "buffer_size", p)) {


'Programming > ffmpeg' 카테고리의 다른 글

ffmpeg deprecated 수정  (0) 2017.03.09
ffplay.c  (0) 2017.03.06
ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
Posted by 구차니
Programming/ffmpeg2017. 3. 6. 16:57

비슷하면서도 많이 다르네..

옛날 소스와 요즘 소스의 차이일려나?


[링크 : https://www.ffmpeg.org/doxygen/0.6/ffplay_8c-source.html]

[링크 : https://www.ffmpeg.org/doxygen/0.6/ffplay_8c.html]


[링크 : http://blog.csdn.net/leixiaohua1020]


[링크 : https://ffmpeg.zeranoe.com/builds/]

'Programming > ffmpeg' 카테고리의 다른 글

ffmpeg deprecated 수정  (0) 2017.03.09
vlc "network-caching" / ffmpeg "buffer_size" 소스 검색  (0) 2017.03.07
ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
Posted by 구차니
Programming/ffmpeg2017. 2. 10. 17:38

[링크 : https://github.com/mpenkov/ffmpeg-tutorial/blob/master/tutorial01.c]


사용된 헤더별 구조체

libavcodec/avcodec.h

- AVCodecContext

- AVCodec

- AVPacket


libavformat/avformat.h

- AVFormatContext


libswscale/swscale_internal.h ??

- SwsContext 


libavutil/frame.h

from libavcodec/avcodec.h

- AVFrame


libavutil/dict.h

- AVDictionary 



av_register_all() // Initialize libavformat and register all the muxers, demuxers and protocols.


avformat_open_input()

avformat_find_stream_info()

av_dump_format()

avcodec_find_decoder()

avcodec_open2()

av_frame_alloc()

avpicture_get_size()


av_malloc()

sws_getContext()


avpicture_fill()

while(av_read_frame())

avcodec_decode_video2()

sws_scale()

av_free_packet()


av_free()

avcodec_close()

avformat_close_input() 


AVFormatContext *pFormatCtx = NULL;

AVCodecContext  *pCodecCtx = NULL;

AVCodec         *pCodec = NULL;

AVFrame         *pFrame = NULL; 

AVFrame         *pFrameRGB = NULL;

AVPacket        packet;

AVDictionary    *optionsDict = NULL;

struct SwsContext      *sws_ctx = NULL;


av_register_all();

avformat_open_input(&pFormatCtx, argv[1], NULL, NULL);

avformat_find_stream_info(pFormatCtx, NULL);

av_dump_format(pFormatCtx, 0, argv[1], 0);


pCodecCtx=pFormatCtx->streams[videoStream]->codec;

pCodec=avcodec_find_decoder(pCodecCtx->codec_id);

avcodec_open2(pCodecCtx, pCodec, &optionsDict)

pFrame=av_frame_alloc();

pFrameRGB=av_frame_alloc();

numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width,

pCodecCtx->height);

buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));


sws_ctx = sws_getContext(

    pCodecCtx->width,

    pCodecCtx->height,

    pCodecCtx->pix_fmt,

    pCodecCtx->width,

    pCodecCtx->height,

    PIX_FMT_RGB24,

    SWS_BILINEAR,

    NULL,

    NULL,

    NULL    );

avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,

pCodecCtx->width, pCodecCtx->height);


while(av_read_frame(pFormatCtx, &packet)>=0)

{

avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished,  &packet);

av_free_packet(&packet);

}

av_free(buffer);

av_free(pFrameRGB);

av_free(pFrame);

avcodec_close(pCodecCtx);

avformat_close_input(&pFormatCtx); 



void av_register_all (void)

// Initialize libavformat and register all the muxers, demuxers and protocols.

[링크 : https://www.ffmpeg.org/.../group__lavf__core.html#ga917265caec45ef5a0646356ed1a507e3]


int avformat_open_input (AVFormatContext ** ps,

const char * url,

AVInputFormat * fmt,

AVDictionary ** options 

)

[링크 : https://www.ffmpeg.org/.../group__lavf__decoding.html#ga31d601155e9035d5b0e7efedc894ee49]


void avformat_close_input (AVFormatContext ** s)

[링크 : https://www.ffmpeg.org/.../group__lavf__decoding.html#gae804b99aec044690162b8b9b110236a4]


int avformat_find_stream_info ( AVFormatContext * ic, AVDictionary ** options )

// Read packets of a media file to get stream information.

[링크 : https://www.ffmpeg.org/.../group__lavf__decoding.html#gad42172e27cddafb81096939783b157bb]


void av_dump_format ( AVFormatContext * ic,

int index,

const char * url,

int is_output 

)

//Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.

[링크 : https://www.ffmpeg.org/.../group__lavf__misc.html#gae2645941f2dc779c307eb6314fd39f10]


AVCodec* avcodec_find_decoder ( enum AVCodecID id )

// Find a registered decoder with a matching codec ID.

[링크 : https://www.ffmpeg.org/.../group__lavc__decoding.html#ga19a0ca553277f019dd5b0fec6e1f9dca]


int avcodec_open2 ( AVCodecContext * avctx,

const AVCodec * codec,

AVDictionary ** options 

)

// Initialize the AVCodecContext to use the given AVCodec.

// Warning - This function is not thread safe!

[링크 : https://www.ffmpeg.org/.../group__lavc__core.html#ga11f785a188d7d9df71621001465b0f1d]


AVFrame* av_frame_alloc ( void )

// Allocate an AVFrame and set its fields to default values.

[링크 : https://www.ffmpeg.org/doxygen/3.2/group__lavu__frame.html#gac700017c5270c79c1e1befdeeb008b2f]


attribute_deprecated int avpicture_get_size ( enum AVPixelFormat pix_fmt,

int width,

int height 

)

[링크 : https://www.ffmpeg.org/doxygen/3.2/group__lavc__picture.html#gad2eba60171ee81107d2ca3a6957f4f2d]


int av_image_get_buffer_size ( enum AVPixelFormat pix_fmt,

int width,

int height,

int align 

)

[링크 : https://www.ffmpeg.org/doxygen/3.2/group__lavu__picture.html#ga24a67963c3ae0054a2a4bab35930e694]


void* av_malloc ( size_t size )

[링크 : https://www.ffmpeg.org/.../group__lavu__mem__funcs.html#ga9722446c5e310ffedfaac9489864796d]



struct SwsContext* sws_getContext ( int srcW,

int srcH,

enum AVPixelFormat srcFormat,

int dstW,

int dstH,

enum AVPixelFormat dstFormat,

int flags,

SwsFilter * srcFilter,

SwsFilter * dstFilter,

const double * param 

)

[링크 : https://www.ffmpeg.org/doxygen/3.2/group__libsws.html#gaf360d1a9e0e60f906f74d7d44f9abfdd]


attribute_deprecated int avpicture_fill ( AVPicture * picture,

const uint8_t * ptr,

enum AVPixelFormat pix_fmt,

int width,

int height 

)

[링크 : https://www.ffmpeg.org/doxygen/3.2/group__lavc__picture.html#gab740f592342cbbe872adf3e85c52e40c]


int av_image_fill_arrays ( uint8_t * dst_data[4],

int dst_linesize[4],

const uint8_t * src,

enum AVPixelFormat pix_fmt,

int width,

int height,

int align 

)

[링크 : https://www.ffmpeg.org/doxygen/3.2/group__lavu__picture.html#ga5b6ead346a70342ae8a303c16d2b3629]


int av_read_frame ( AVFormatContext * s,

AVPacket * pkt 

)

[링크 : https://www.ffmpeg.org/doxygen/3.2/group__lavf__decoding.html#ga4fdb3084415a82e3810de6ee60e46a61]


attribute_deprecated int avcodec_decode_video2 ( AVCodecContext * avctx,

AVFrame * picture,

int * got_picture_ptr,

const AVPacket * avpkt 

)

[링크 : https://www.ffmpeg.org/doxygen/3.2/group__lavc__decoding.html#ga3ac51525b7ad8bca4ced9f3446e96532]


int avcodec_receive_frame ( AVCodecContext * avctx,

AVFrame * frame 

)

[링크 : https://www.ffmpeg.org/doxygen/3.2/group__lavc__decoding.html#ga11e6542c4e66d3028668788a1a74217c]




+

2017.03.06


avcodec_register_all();

av_register_all();

avformat_network_init();


[링크 : http://laconicd.blogspot.com/2014/01/ffmpeg.html]

[링크 : http://egloos.zum.com/aslike/v/3083403]


+

2017.03.08

[링크 : https://www.codeproject.com/Tips/111468/FFmpeg-Tutorial]

[링크 : http://dranger.com/ffmpeg/tutorial01.html]

[링크 : https://ffmpeg.org/doxygen/trunk/doc_2examples_2decoding_encoding_8c-example.html]

'Programming > ffmpeg' 카테고리의 다른 글

vlc "network-caching" / ffmpeg "buffer_size" 소스 검색  (0) 2017.03.07
ffplay.c  (0) 2017.03.06
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
ffmpeg + opengl  (0) 2017.02.09
Posted by 구차니
Programming/ffmpeg2017. 2. 10. 17:20

'Programming > ffmpeg' 카테고리의 다른 글

ffplay.c  (0) 2017.03.06
ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
ffmpeg + opengl  (0) 2017.02.09
ffmpeg / ffplay 딜레이 관련 분석  (0) 2017.02.09
Posted by 구차니
Programming/ffmpeg2017. 2. 10. 13:33

도대체 vlc의  :network-caching 설정은 어디를 적용하는거야?!?!?


일단 구조적으로

rtsp 쪽 네트워크 버퍼

ffmpeg avcodec decoder쪽 버퍼

sdl등의 비디오 버퍼

버퍼만 해도 세개인데 어느녀석을 건드려야 레이턴시가 줄어들까?


[링크 : https://wiki.videolan.org/..HowTo/Advanced_Streaming_Using_the_Command_Line/]

[링크 : http://stackoverflow.com/.../which-functions-of-live555-is-used-in-vlc-for-network-caching-option]

'Programming > ffmpeg' 카테고리의 다른 글

ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg + opengl  (0) 2017.02.09
ffmpeg / ffplay 딜레이 관련 분석  (0) 2017.02.09
ffmpeg 예제 (sdl / live555)  (0) 2017.02.06
Posted by 구차니
Programming/ffmpeg2017. 2. 9. 21:21


[링크 : http://aslike.egloos.com/category/└%20FFMPEG] // 연재 중단으로 openGL 관련내용 x

[링크 : http://sijoo.tistory.com/82]

'Programming > ffmpeg' 카테고리의 다른 글

ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
ffmpeg / ffplay 딜레이 관련 분석  (0) 2017.02.09
ffmpeg 예제 (sdl / live555)  (0) 2017.02.06
Posted by 구차니
Programming/ffmpeg2017. 2. 9. 19:43

vlc 에서 rtsp 추가 옵션을 보면

캐쉬로 기본 1000ms 가 설정되는데 이걸 어디서 설정하나 검색중..


ffplay의 max_delay?

ffplay -max_delay 500000 -rtsp_transport udp -v trace "rtsp://user:pass@CamIP:Port/URL" 

[링크 : https://github.com/ZoneMinder/ZoneMinder/issues/811]


ffplay -h 도움말을 보니 이렇게 us 단위라네..

-max_delay         <int>   ED... maximum muxing or demuxing delay in microseconds 


다시 읽어 보니.. 레이턴시에 영향을 주긴 하지만.. TCP에는 적용사항이 없고

UDP에서 패킷 재조합시간에 대한 내용이라 일단 패스~

When receiving data over UDP, the demuxer tries to reorder received packets (since they may arrive out of order, or packets may get lost totally). This can be disabled by setting the maximum demuxing delay to zero (via the max_delay field of AVFormatContext). 

[링크 : https://ffmpeg.org/ffmpeg-protocols.html#rtsp]

[링크 : https://ffmpeg.org/doxygen/2.7/structAVFormatContext.html#a58422ed3d461b3440a15cf057ac5f5b7]


AVFormatContext의 buffer_size

cache 버퍼 크기

av_dict_set(&options, "buffer_size", "655360", 0); 

[링크 : http://stackoverflow.com/questions/29075467/set-rtsp-udp-buffer-size-in-ffmpeg-libav]

  [링크 : https://git.libav.org/?p=libav.git;a=commit;h=e3ec6fe7bb2a622a863e3912181717a659eb1bad] commit log

  [링크 : https://git.libav.org/?p=libav.git;a=blob;f=libavformat/rtsp.c;h...d] rtsp whole source

  [링크 : https://git.libav.org/?p=libav.git;a=blobdiff;f=libavformat/rtsp.c;h...f] diff


1547 AVDictionary *metadata;

[링크 : https://ffmpeg.org/doxygen/trunk/avformat_8h_source.html#l01331] AVFormatContext structure


int av_dict_set (AVDictionary ** pm, const char * key, const char * value, int flags ) 

[링크 : https://www.ffmpeg.org/doxygen/2.7/group__lavu__dict.html#ga8d9c2de72b310cef8e6a28c9cd3acbbe]


AVCodecContext의 rc_buffer_size

int AVCodecContext::rc_buffer_size

decoder bitstream buffer size


encoding: Set by user.

decoding: unused

Definition at line 2291 of file avcodec.h. 

[링크 : https://www.ffmpeg.org/doxygen/2.5/structAVCodecContext.html#a15000607a7e2371162348bb35b0184c1]


일단... 두개 옵션을 줘서 어느 구간에서 지연시간들이 생기는지 검사할 수 있는 듯?

Also setting -probesize and -analyzeduration to low values may help your stream start up more quickly (it uses these to scan for "streams" in certain muxers, like ts, where some can appears "later", and also to estimate the duration, which, for live streams, the latter you don't need anyway). This should be unneeded by dshow input. 

[링크 : https://trac.ffmpeg.org/wiki/StreamingGuide#Latency]

'Programming > ffmpeg' 카테고리의 다른 글

ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
ffmpeg + opengl  (0) 2017.02.09
ffmpeg 예제 (sdl / live555)  (0) 2017.02.06
Posted by 구차니
Programming/ffmpeg2017. 2. 6. 15:37

윈도우용 live555 + ffmpeg 프로그램 만들일이 생길것 같아 미리 조사중..



퍼포먼스를 위해서 sdl을 이용하는 녀석.. live555를 통한 rtsp는 제외 된 듯

sdl / ffmpeg / vs2010

[링크 : https://sourceforge.net/projects/simplestffmpegplayer/]

    [링크 : https://sourceforge.net/u/leixiaohua1020/wiki/Home/]

[링크 : https://www.libsdl.org/]


113MB ... ㄷㄷㄷ

[링크 : https://www.imc-store.com.au/Articles.asp?ID=278]


먼가 빈약해 보이는데..

sdl / ffmpeg / live555 / visual studio

[링크 : https://github.com/yuvalk/demoLive555withFFMPEG]

'Programming > ffmpeg' 카테고리의 다른 글

ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
ffmpeg + opengl  (0) 2017.02.09
ffmpeg / ffplay 딜레이 관련 분석  (0) 2017.02.09
Posted by 구차니