Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. av_register_all();
  2. avformat_network_init();
  3. AVDictionary *option = NULL;
  4. const char* url = "rtsp://local_watcher/live.sdp";
  5. av_dict_set(&option, "rtsp_transport", "tcp", 0);
  6. // Open RTSP
  7. int err = avformat_open_input(&ctx, url, NULL, &option);
  8.  
  9. av_dict_free(&option);
  10.  
  11. int index = -1;
  12. for (int i = 0; i < ctx->nb_streams; i++) {
  13. if (ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
  14. index = i;
  15. break;
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement