SlideShare ist ein Scribd-Unternehmen logo
1 von 17
FFmpeg
2012-04-01 Eric
outline
 work flow process
 structure
 my SOP
work flow process

   Input


                                    Video Data
File   Demuxer   stream   Decoder   Audio Data
                                    Subtitle Data
work flow process

Output

                                  Video Data
File   Muxer   stream   Encoder   Audio Data

                                  Subtitle Data
structure
AVFormatContext




  Stream[n]       AVStream


                             AVCodecContext
                  Codec
                                 Codec
                                 Bitrate
                                  FPS
                     ……….
                               Sample_rate
                                  …..
my SOP
step 1
 include headers

           extern	 "C"	 {
           #include	 "libavformat/avformat.h"
           #include	 "libavutil/base64.h"
           }

  initial ffmpeg

           av_register_all()
step 2

link library


        FFMPEGLIBS	 =	 -lavcodec	 -lavformat	 -lavutil
step 3
 set up out format

   AVFormatContext          avformat_alloc_context




   AVOutputFormat           av_guess_format




  if format did not support, please set up configure file.
step 4
 we need to prepare some codec
 structures.

        AVFormatContext




                                    av_new_stream(c, channel)
    video                 audio
   AVStream           AVStream

    video                 audio
                                    stream->codec
AVCodecContext     AVCodecContext
step 5
 set up video codec
              	 msrAVCodecContextVideo->codec_id	 =	 CODEC_ID_MPEG4;
 	 	 	 	 	 	 	 	 msrAVCodecContextVideo->codec_type	 =	 CODEC_TYPE_VIDEO;
 	 	 	 	 	 	 	 	 msrAVCodecContextVideo->bit_rate=	 iBitrate;
 	 	 	 	 	 	 	 	 msrAVCodecContextVideo->width=	 iWidth;
 	 	 	 	 	 	 	 	 msrAVCodecContextVideo->height=	 iHeight;
 	 	 	 	 	 	 	 	 msrAVCodecContextVideo->time_base.den	 =	 iFps;
 	 	 	 	 	 	 	 	 msrAVCodecContextVideo->time_base.num	 =	 1;
 	 	 	 	 	 	 	 	 msrAVCodecContextVideo->gop_size=	 iFps;
 	 	 	 	 	 	 	 	 msrAVCodecContextVideo->pix_fmt=	 PIX_FMT_YUV420P;
 	 	 	 	 	 	 	 	 msrAVCodecContextVideo->max_b_frames=0;
step 6
 set up audio codec
 	 	 	 	 	 	 	 	 msrAVCodecContextAudio	 =	 msrAVStreamAudio->codec;
 	 	 	 	 	 	 	 	 msrAVCodecContextAudio->codec_id	 =	 CODEC_ID_PCM_S16LE;
 	 	 	 	 	 	 	 	 msrAVCodecContextAudio->codec_type	 =	 CODEC_TYPE_AUDIO;
 	 	 	 	 	 	 	 	 msrAVCodecContextAudio->bit_rate	 =	 128000	 ;
 	 	 	 	 	 	 	 	 msrAVCodecContextAudio->sample_rate	 =	 8000;
 	 	 	 	 	 	 	 	 msrAVCodecContextAudio->channels	 =	 1;
step 7
 open file descriptor and write header
  if(url_fopen(&sAVFormatContext->pb,	 pathName,	 URL_WRONLY)	 <	 0)
  {
      //error	 handle
  }
  av_write_header(sAVFormatContext);


 the pathName can be following
   file://tmp/aaaa

   tcp://x99

   udp://x88
step 8
 try to write some data
      AVPacket	 sePacket;
      av_init_packet(&sePacket);
      sePacket.flags	 |=	 PKT_FLAG_KEY;
      sePacket.stream_index	 =	 channel;	 //which	 channel
      sePacket.data	 =	 data;
      sePacket.size	 =	 len;
      //sePacket.pts	 =	 ???;	 //explain	 later
      av_write_frame(sAVFormatContext,	 &sePacket);
      printf(“pts:	 %dn”,	 sePacket.pts);
      av_free_packet(&sePacket);

      if(sAVFormatContext->pb->error	 <	 0)	 
      {
          //error	 handle
      }
step 9
 close file descriptor

 if(sAVFormatContext->pb	 !=	 NULL){
 	 	 	 	 	 	 	 	 av_write_trailer(sAVFormatContext);
 	 	 	 	 	 	 	 	 if(url_fclose(sAVFormatContext->pb)	 <	 0)
 	 	 	 	 	 	 	 	 {
 	 	 	 	 	 	 	 	 	 	 	 	 perror("Close	 file	 failed.");
        	 	 	 	 	 }
 	 	 	 	 	 	 	 	 sAVFormatContext->pb	 =	 NULL;
 }
step 10

 get pts against different codec
 1. let ffmpeg print and simulate it.
 2. see RFC.
 3. find pts calculate from ffmpeg source
   code.
Thanks a lot.

Weitere ähnliche Inhalte

Was ist angesagt?

Spm unit2 select appropriate approach
Spm unit2 select appropriate approachSpm unit2 select appropriate approach
Spm unit2 select appropriate approachDevyani Vasistha
 
Kivy Talk Python Meetup Innsbruck 2017.04.25
Kivy Talk Python Meetup Innsbruck 2017.04.25Kivy Talk Python Meetup Innsbruck 2017.04.25
Kivy Talk Python Meetup Innsbruck 2017.04.25Robert Niederreiter
 
Spm project planning
Spm project planning Spm project planning
Spm project planning Kanchana Devi
 
Linux : The Common Mailbox Framework
Linux : The Common Mailbox FrameworkLinux : The Common Mailbox Framework
Linux : The Common Mailbox FrameworkMr. Vengineer
 
Linux field-update-2015
Linux field-update-2015Linux field-update-2015
Linux field-update-2015Chris Simmonds
 
Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Asfand Hassan
 
Unit 3 principles of programming language
Unit 3 principles of programming languageUnit 3 principles of programming language
Unit 3 principles of programming languageVasavi College of Engg
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardAnne Nicolas
 
Training report of C language
Training report of C languageTraining report of C language
Training report of C languageShashank Kapoor
 
Python GUI Programming
Python GUI ProgrammingPython GUI Programming
Python GUI ProgrammingRTS Tech
 
Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)Thomas Petazzoni
 
Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming Rokonuzzaman Rony
 
Introduction to ARM big.LITTLE technology
Introduction to ARM big.LITTLE technologyIntroduction to ARM big.LITTLE technology
Introduction to ARM big.LITTLE technology義洋 顏
 

Was ist angesagt? (20)

Operating systems galvin-ch1
Operating systems galvin-ch1Operating systems galvin-ch1
Operating systems galvin-ch1
 
Spm unit2 select appropriate approach
Spm unit2 select appropriate approachSpm unit2 select appropriate approach
Spm unit2 select appropriate approach
 
Kivy Talk Python Meetup Innsbruck 2017.04.25
Kivy Talk Python Meetup Innsbruck 2017.04.25Kivy Talk Python Meetup Innsbruck 2017.04.25
Kivy Talk Python Meetup Innsbruck 2017.04.25
 
Spm project planning
Spm project planning Spm project planning
Spm project planning
 
Linux : The Common Mailbox Framework
Linux : The Common Mailbox FrameworkLinux : The Common Mailbox Framework
Linux : The Common Mailbox Framework
 
Linux field-update-2015
Linux field-update-2015Linux field-update-2015
Linux field-update-2015
 
Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)
 
Unit 3 principles of programming language
Unit 3 principles of programming languageUnit 3 principles of programming language
Unit 3 principles of programming language
 
Linux device drivers
Linux device driversLinux device drivers
Linux device drivers
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
 
Training report of C language
Training report of C languageTraining report of C language
Training report of C language
 
Files in java
Files in javaFiles in java
Files in java
 
Python GUI Programming
Python GUI ProgrammingPython GUI Programming
Python GUI Programming
 
Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)
 
Introduction to BeagleBone Black
Introduction to BeagleBone BlackIntroduction to BeagleBone Black
Introduction to BeagleBone Black
 
Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming
 
Linux boot process
Linux boot processLinux boot process
Linux boot process
 
VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
 
Introduction to ARM big.LITTLE technology
Introduction to ARM big.LITTLE technologyIntroduction to ARM big.LITTLE technology
Introduction to ARM big.LITTLE technology
 
Criteria-III-NBA.pdf
Criteria-III-NBA.pdfCriteria-III-NBA.pdf
Criteria-III-NBA.pdf
 

Andere mochten auch

Andere mochten auch (20)

FFmpeg presentation
FFmpeg presentationFFmpeg presentation
FFmpeg presentation
 
FFmpeg: A Retrospective
FFmpeg: A RetrospectiveFFmpeg: A Retrospective
FFmpeg: A Retrospective
 
FFMPEG on android
FFMPEG on androidFFMPEG on android
FFMPEG on android
 
FFmpeg
FFmpegFFmpeg
FFmpeg
 
Lunch and Learn - FFmpeg
Lunch and Learn - FFmpegLunch and Learn - FFmpeg
Lunch and Learn - FFmpeg
 
FFmpeg - the universal multimedia toolkit
FFmpeg - the universal multimedia toolkitFFmpeg - the universal multimedia toolkit
FFmpeg - the universal multimedia toolkit
 
Why Open Source is Important and What are We Doing About it?
Why Open Source is Important and What are We Doing About it?Why Open Source is Important and What are We Doing About it?
Why Open Source is Important and What are We Doing About it?
 
Ffmpeg
FfmpegFfmpeg
Ffmpeg
 
Lab2
Lab2Lab2
Lab2
 
work order of logic laboratory
work order of logic laboratory work order of logic laboratory
work order of logic laboratory
 
Bozorgmeh os lab
Bozorgmeh os labBozorgmeh os lab
Bozorgmeh os lab
 
Gun make
Gun makeGun make
Gun make
 
Programs for Operating System
Programs for Operating SystemPrograms for Operating System
Programs for Operating System
 
Os file
Os fileOs file
Os file
 
Os lab file c programs
Os lab file c programsOs lab file c programs
Os lab file c programs
 
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
Lab manual operating system [cs 502 rgpv] (usefulsearch.org)  (useful search)Lab manual operating system [cs 502 rgpv] (usefulsearch.org)  (useful search)
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
 
OS tutoring #1
OS tutoring #1OS tutoring #1
OS tutoring #1
 
O.s. lab all_experimets
O.s. lab all_experimetsO.s. lab all_experimets
O.s. lab all_experimets
 
Openssl
OpensslOpenssl
Openssl
 
Ooad lab manual
Ooad lab manualOoad lab manual
Ooad lab manual
 

Ähnlich wie FFmpeg

Media Frameworks Versus Swift (Swift by Northwest, October 2017)
Media Frameworks Versus Swift (Swift by Northwest, October 2017)Media Frameworks Versus Swift (Swift by Northwest, October 2017)
Media Frameworks Versus Swift (Swift by Northwest, October 2017)Chris Adamson
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Bastian Feder
 
php & performance
 php & performance php & performance
php & performancesimon8410
 
Introduction to Snort Rule Writing
Introduction to Snort Rule WritingIntroduction to Snort Rule Writing
Introduction to Snort Rule WritingCisco DevNet
 
Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009PHPBelgium
 
Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Max Kleiner
 
Webvideo, FFmpeg und Drupal
Webvideo, FFmpeg und DrupalWebvideo, FFmpeg und Drupal
Webvideo, FFmpeg und DrupalWalter Ebert
 
Embedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops wayEmbedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops wayAnne Nicolas
 
Code Igniter Code Sniffer
Code Igniter  Code SnifferCode Igniter  Code Sniffer
Code Igniter Code SnifferAlbert Rosa
 
Forward Swift 2017: Media Frameworks and Swift: This Is Fine
Forward Swift 2017: Media Frameworks and Swift: This Is FineForward Swift 2017: Media Frameworks and Swift: This Is Fine
Forward Swift 2017: Media Frameworks and Swift: This Is FineChris Adamson
 
Virtual platform
Virtual platformVirtual platform
Virtual platformsean chen
 
PHP & Performance
PHP & PerformancePHP & Performance
PHP & Performance毅 吕
 
Tips
TipsTips
Tipsmclee
 
Orchestrating the execution of workflows for media streaming service and even...
Orchestrating the execution of workflows for media streaming service and even...Orchestrating the execution of workflows for media streaming service and even...
Orchestrating the execution of workflows for media streaming service and even...Shuen-Huei Guan
 
Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014Chris Adamson
 
Efficient System Monitoring in Cloud Native Environments
Efficient System Monitoring in Cloud Native EnvironmentsEfficient System Monitoring in Cloud Native Environments
Efficient System Monitoring in Cloud Native EnvironmentsGergely Szabó
 
eBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging InfrastructureeBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging InfrastructureNetronome
 
Modern Linux Tracing Landscape
Modern Linux Tracing LandscapeModern Linux Tracing Landscape
Modern Linux Tracing LandscapeSasha Goldshtein
 

Ähnlich wie FFmpeg (20)

Media Frameworks Versus Swift (Swift by Northwest, October 2017)
Media Frameworks Versus Swift (Swift by Northwest, October 2017)Media Frameworks Versus Swift (Swift by Northwest, October 2017)
Media Frameworks Versus Swift (Swift by Northwest, October 2017)
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
php & performance
 php & performance php & performance
php & performance
 
Introduction to Snort Rule Writing
Introduction to Snort Rule WritingIntroduction to Snort Rule Writing
Introduction to Snort Rule Writing
 
Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009
 
Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2
 
Statyczna analiza kodu PHP
Statyczna analiza kodu PHPStatyczna analiza kodu PHP
Statyczna analiza kodu PHP
 
Webvideo, FFmpeg und Drupal
Webvideo, FFmpeg und DrupalWebvideo, FFmpeg und Drupal
Webvideo, FFmpeg und Drupal
 
Embedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops wayEmbedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops way
 
Code Igniter Code Sniffer
Code Igniter  Code SnifferCode Igniter  Code Sniffer
Code Igniter Code Sniffer
 
Forward Swift 2017: Media Frameworks and Swift: This Is Fine
Forward Swift 2017: Media Frameworks and Swift: This Is FineForward Swift 2017: Media Frameworks and Swift: This Is Fine
Forward Swift 2017: Media Frameworks and Swift: This Is Fine
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
PHP & Performance
PHP & PerformancePHP & Performance
PHP & Performance
 
Tips
TipsTips
Tips
 
Orchestrating the execution of workflows for media streaming service and even...
Orchestrating the execution of workflows for media streaming service and even...Orchestrating the execution of workflows for media streaming service and even...
Orchestrating the execution of workflows for media streaming service and even...
 
Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014
 
Efficient System Monitoring in Cloud Native Environments
Efficient System Monitoring in Cloud Native EnvironmentsEfficient System Monitoring in Cloud Native Environments
Efficient System Monitoring in Cloud Native Environments
 
eBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging InfrastructureeBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging Infrastructure
 
SDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLSSDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLS
 
Modern Linux Tracing Landscape
Modern Linux Tracing LandscapeModern Linux Tracing Landscape
Modern Linux Tracing Landscape
 

Kürzlich hochgeladen

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 

Kürzlich hochgeladen (20)

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

FFmpeg

  • 2. outline work flow process structure my SOP
  • 3. work flow process Input Video Data File Demuxer stream Decoder Audio Data Subtitle Data
  • 4. work flow process Output Video Data File Muxer stream Encoder Audio Data Subtitle Data
  • 5. structure AVFormatContext Stream[n] AVStream AVCodecContext Codec Codec Bitrate FPS ………. Sample_rate …..
  • 7. step 1 include headers extern "C" { #include "libavformat/avformat.h" #include "libavutil/base64.h" } initial ffmpeg av_register_all()
  • 8. step 2 link library FFMPEGLIBS = -lavcodec -lavformat -lavutil
  • 9. step 3 set up out format AVFormatContext avformat_alloc_context AVOutputFormat av_guess_format if format did not support, please set up configure file.
  • 10. step 4 we need to prepare some codec structures. AVFormatContext av_new_stream(c, channel) video audio AVStream AVStream video audio stream->codec AVCodecContext AVCodecContext
  • 11. step 5 set up video codec msrAVCodecContextVideo->codec_id = CODEC_ID_MPEG4; msrAVCodecContextVideo->codec_type = CODEC_TYPE_VIDEO; msrAVCodecContextVideo->bit_rate= iBitrate; msrAVCodecContextVideo->width= iWidth; msrAVCodecContextVideo->height= iHeight; msrAVCodecContextVideo->time_base.den = iFps; msrAVCodecContextVideo->time_base.num = 1; msrAVCodecContextVideo->gop_size= iFps; msrAVCodecContextVideo->pix_fmt= PIX_FMT_YUV420P; msrAVCodecContextVideo->max_b_frames=0;
  • 12. step 6 set up audio codec msrAVCodecContextAudio = msrAVStreamAudio->codec; msrAVCodecContextAudio->codec_id = CODEC_ID_PCM_S16LE; msrAVCodecContextAudio->codec_type = CODEC_TYPE_AUDIO; msrAVCodecContextAudio->bit_rate = 128000 ; msrAVCodecContextAudio->sample_rate = 8000; msrAVCodecContextAudio->channels = 1;
  • 13. step 7 open file descriptor and write header if(url_fopen(&sAVFormatContext->pb, pathName, URL_WRONLY) < 0) { //error handle } av_write_header(sAVFormatContext); the pathName can be following file://tmp/aaaa tcp://x99 udp://x88
  • 14. step 8 try to write some data AVPacket sePacket; av_init_packet(&sePacket); sePacket.flags |= PKT_FLAG_KEY; sePacket.stream_index = channel; //which channel sePacket.data = data; sePacket.size = len; //sePacket.pts = ???; //explain later av_write_frame(sAVFormatContext, &sePacket); printf(“pts: %dn”, sePacket.pts); av_free_packet(&sePacket); if(sAVFormatContext->pb->error < 0) { //error handle }
  • 15. step 9 close file descriptor if(sAVFormatContext->pb != NULL){ av_write_trailer(sAVFormatContext); if(url_fclose(sAVFormatContext->pb) < 0) { perror("Close file failed."); } sAVFormatContext->pb = NULL; }
  • 16. step 10 get pts against different codec 1. let ffmpeg print and simulate it. 2. see RFC. 3. find pts calculate from ffmpeg source code.

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n