libgpac
Documentation of the core library of GPAC
ISOBMF Importers

Media importing. More...

+ Collaboration diagram for ISOBMF Importers:

Data Structures

struct  __track_video_info
 
struct  __track_audio_info
 
struct  __track_import_info
 
struct  __program_import_info
 
struct  GF_MediaImporter
 

Macros

#define GF_IMPORT_DEFAULT_FPS
 
#define GF_IMPORT_MAX_TRACKS   100
 

Enumerations

enum  {
  GF_IMPORT_USE_DATAREF = 1 , GF_IMPORT_NO_FRAME_DROP = 1<<1 , GF_IMPORT_FORCE_PACKED = 1<<2 , GF_IMPORT_SBR_IMPLICIT = 1<<3 ,
  GF_IMPORT_SBR_EXPLICIT = 1<<4 , GF_IMPORT_FORCE_MPEG4 = 1<<5 , GF_IMPORT_SKIP_TXT_BOX = 1<<6 , GF_IMPORT_USE_COMPACT_SIZE = 1<<8 ,
  GF_IMPORT_NO_TEXT_FLUSH = 1<<9 , GF_IMPORT_SVC_EXPLICIT = 1<<10 , GF_IMPORT_SVC_NONE = 1<<11 , GF_IMPORT_PS_IMPLICIT = 1<<12 ,
  GF_IMPORT_PS_EXPLICIT = 1<<13 , GF_IMPORT_OVSBR = 1<<14 , GF_IMPORT_SET_SUBSAMPLES = 1<<15 , GF_IMPORT_FORCE_SYNC = 1<<16 ,
  GF_IMPORT_KEEP_TRAILING = 1<<17 , GF_IMPORT_NO_EDIT_LIST = 1<<19 , GF_IMPORT_PROBE_ONLY = 1<<20 , GF_IMPORT_3GPP_AGGREGATION = 1<<21 ,
  GF_IMPORT_OVERRIDE_FPS = 1<<22 , GF_IMPORT_NO_DURATION = 1<<23 , GF_IMPORT_MPE_DEMUX = 1<<24 , GF_IMPORT_NO_VPS_EXTENSIONS = 1<<25 ,
  GF_IMPORT_NO_SEI = 1<<26 , GF_IMPORT_KEEP_REFS = 1<<27 , GF_IMPORT_KEEP_AV1_TEMPORAL_OBU = 1<<28 , GF_IMPORT_SAMPLE_DEPS = 1<<29
}
 

Functions

GF_Err gf_media_import (GF_MediaImporter *importer)
 
GF_Err gf_media_import_chapters (GF_ISOFile *isom_file, char *chap_file, GF_Fraction import_fps, Bool for_qt)
 
GF_Err gf_media_make_isma (GF_ISOFile *isom_file, Bool keepESIDs, Bool keepImage, Bool no_ocr)
 
GF_Err gf_media_make_3gpp (GF_ISOFile *isom_file)
 
GF_Err gf_media_make_psp (GF_ISOFile *isom_file)
 
GF_Err gf_media_check_qt_prores (GF_ISOFile *qt_file)
 

Detailed Description

This section documents media tools helper functions for importing, exporting and analysing.


Data Structure Documentation

◆ __track_video_info

struct __track_video_info

Track info for video media

Data Fields
u32 width

video width in coded samples

u32 height

video height in coded samples

u32 par

pixel aspect ratio expressed as 32 bits, high 16 bits being the numerator and low ones being the denominator

Bool temporal_enhancement

temporal enhancement flag

Double FPS

Video frame rate

◆ __track_audio_info

struct __track_audio_info

Track info for audio media

Data Fields
u32 sample_rate

audio sample rate

u32 nb_channels

number of channels

u32 samples_per_frame

samples per frame

◆ __track_import_info

struct __track_import_info

Track info for any media

+ Collaboration diagram for __track_import_info:
Data Fields
u32 track_num

ID of the track (PID, TrackID, etc ...)

u32 stream_type

stream type (one of GF_STREAM_XXXX)

u32 codecid

codec ID ( one of GF_CODECID_XXX*)

u32 media_subtype

GF_ISOM_MEDIA_* : vide, auxv, pict

Bool is_chapter
struct __track_video_info video_info

video format info

struct __track_audio_info audio_info

audio format info

char szCodecProfile[20]

codec profile according to 6381

u32 lang

language of the media, 0/'und ' if not known

u32 mpeg4_es_id

MPEG-4 ES-ID, only used for MPEG4 on MPEG-2 TS

u16 prog_num

Program number for MPEG2 TS

◆ __program_import_info

struct __program_import_info

Program info for the source file/stream

Data Fields
u32 number

program number, as used in MPEG-2 TS

char name[40]

program name

◆ GF_MediaImporter

struct GF_MediaImporter

Track importer object

+ Collaboration diagram for GF_MediaImporter:
Data Fields
GF_ISOFile * dest

destination ISOBMFF file where the media is to be imported

u32 trackID

media to import: MP4/ISO media: trackID AVI files: 0: first video and first audio, 1: video track 2->any: audio track(s) MPEG-PS files with N video streams: 0: first video and first audio 1->N: video track N+1->any: audio track TrackNums can be obtain with probing

char * in_name

media source - selects importer type based on extension

GF_Fraction duration

import duration if any

u32 flags

importer flags

u32 swf_flags

importer swf flags

Float swf_flatten_angle

importer swf flatten angle when converting curves

GF_Fraction video_fps

Forced video FPS (CMP, AVI, OGG, H264) - also used by SUB import. Ignored if 0

GF_ESD * esd

optional ESD to be updated by the importer (used for BT/XMT import)

char * streamFormat

optional format indication for media source (used in IM1 reference software)

u32 frames_per_sample

frame per sample cumulation (3GP media only) - MAX 15, ignored when data ref is used

u32 final_trackID

track ID of imported media in destination file

char * force_ext

optional format indication for media source (used in IM1)

GF_ISOFile * orig

for MP4 import only, the source MP4 to be used

u32 fontSize

default font size for text import

char * fontName

default font name for text import

u32 text_track_width

width of the imported text track

u32 text_track_height

height of the imported text track

u32 text_width

width of the imported text display area (as indicated in text sample description)

u32 text_height

height of the imported text display area (as indicated in text sample description)

s32 text_x

horizontal offset of the imported text display area (as indicated in text sample description)

s32 text_y

vertical offset of the imported text display area (as indicated in text sample description)

Double initial_time_offset

Initial offset of the first AU to import. Only used for still images and AFX streams

u32 nb_tracks

number of tracks after probing - may be set to 0, in which case no track selection can be performed. It may also be inaccurate if probing doesn't detect all available tracks (cf ogg import)

struct __track_import_info tk_info[GF_IMPORT_MAX_TRACKS]

track info after probing (GF_IMPORT_PROBE_ONLY set).

u64 probe_duration

duration of the probe for MPEG_2 TS cases.

u32 nb_progs

for MPEG-TS and similar: number of program info

struct __program_import_info pg_info[GF_IMPORT_MAX_TRACKS]

for MPEG-TS and similar: program info

GF_Err last_error

last error encountered during import, internal to the importer

const char * filter_src_opts

any filter options to pass to source

const char * filter_dst_opts

any filter options to pass to sink

const char * filter_chain

filter chain to insert before destination, formatted as "f1[:args]@f2[:args]" options to pass to sink

Bool is_chain_old_syntax
GF_AudioSampleEntryImportMode asemode

force mode for the created ISOBMFF sample entry

Bool is_alpha

indicate to tag the imported media as an alpha channel stream

Bool keep_audelim

keep AU delimiter in file if allowed by specification

u32 xps_inband

import as NAL-based video using inband parameter sets

u32 print_stats_graph

flag for session stats and graph dumping

u32 prog_id

target program ID of source MPEG-2 stream to import

s32 moov_timescale

target timescale to set

u32 target_trackID

value for created track 0: let importer decide 0xFFFFFFFF: try to keep source ID other value: trackk ID value

u64 source_magic
GF_FilterSession * run_in_session

the session in which to add the importer (for -new-fs option only). If null, the importer runs its own session right away

char * update_mux_args

muxer arguments when running multiple importers in one session

char * update_mux_sid

muxer source ID argument when running multiple importers in one session

u32 track_index

index of source importer when running multiple importers in one session

Double start_time

target start time in source

Macro Definition Documentation

◆ GF_IMPORT_DEFAULT_FPS

#define GF_IMPORT_DEFAULT_FPS

Default import FPS for video when no VUI/timing information is found

◆ GF_IMPORT_MAX_TRACKS

#define GF_IMPORT_MAX_TRACKS   100

max supported numbers of tracks in importer

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Track importer flags

Enumerator
GF_IMPORT_USE_DATAREF 

references data rather than copy, whenever possible

GF_IMPORT_NO_FRAME_DROP 

for AVI video: imports at constant FPS (eg imports N-Vops due to encoder drops)

GF_IMPORT_FORCE_PACKED 

for CMP ASP only: forces treating the input as packed bitsream and discards all n-vops

GF_IMPORT_SBR_IMPLICIT 

for AAC audio: forces SBR mode with implicit signaling (backward compatible)

GF_IMPORT_SBR_EXPLICIT 

for AAC audio: forces SBR mode with explicit signaling (non-backward compatible). Will override GF_IMPORT_SBR_IMPLICIT flag when set

GF_IMPORT_FORCE_MPEG4 

forces MPEG-4 import - some 3GP2 streams have both native IsoMedia sample description and MPEG-4 one possible

GF_IMPORT_SKIP_TXT_BOX 

special flag for text import at run time (never set on probe), indicates to leave the text box empty so that we dynamically adapt to display size

GF_IMPORT_USE_COMPACT_SIZE 

uses compact size in .MOV/.IsoMedia files

GF_IMPORT_NO_TEXT_FLUSH 

don't add a final empty sample when importing text tracks from srt

GF_IMPORT_SVC_EXPLICIT 

for SVC or LHVC video: forces explicit SVC / LHVC signaling

GF_IMPORT_SVC_NONE 

for SVC / LHVC video: removes all SVC / LHVC extensions

GF_IMPORT_PS_IMPLICIT 

for AAC audio: forces PS mode with implicit signaling (backward compatible)

GF_IMPORT_PS_EXPLICIT 

for AAC audio: forces PS mode with explicit signaling (non-backward compatible). Will override GF_IMPORT_PS_IMPLICIT flag when set

GF_IMPORT_OVSBR 

oversampled SBR

GF_IMPORT_SET_SUBSAMPLES 

set subsample information with SVC

GF_IMPORT_FORCE_SYNC 

force to mark non-IDR frames with sync data (I slices,) to be marked as sync points points THE RESULTING FILE IS NOT COMPLIANT

GF_IMPORT_KEEP_TRAILING 

keep trailing 0 bytes in AU payloads when any

GF_IMPORT_NO_EDIT_LIST 

do not compute edit list for B-frames video tracks

GF_IMPORT_PROBE_ONLY 

when set, only updates tracks info and return

GF_IMPORT_3GPP_AGGREGATION 

only set when probing, signals several frames per sample possible

GF_IMPORT_OVERRIDE_FPS 

only set when probing, signals video FPS overridable

GF_IMPORT_NO_DURATION 

only set when probing, signals duration not usable

GF_IMPORT_MPE_DEMUX 

when set IP packets found in MPE sections will be sent to the local network

GF_IMPORT_NO_VPS_EXTENSIONS 

when set HEVC VPS is rewritten to remove VPS extensions

GF_IMPORT_NO_SEI 

when set no SEI messages are imported

GF_IMPORT_KEEP_REFS 

keeps track references when importing a single track

GF_IMPORT_KEEP_AV1_TEMPORAL_OBU 

keeps AV1 temporal delimiter OBU in the samples

GF_IMPORT_SAMPLE_DEPS 

imports sample dependencies information

Function Documentation

◆ gf_media_import()

GF_Err gf_media_import ( GF_MediaImporter importer)

Imports a media file

Parameters
importerthe importer object
Returns
error if any

◆ gf_media_import_chapters()

GF_Err gf_media_import_chapters ( GF_ISOFile isom_file,
char *  chap_file,
GF_Fraction  import_fps,
Bool  for_qt 
)

Adds chapter info contained in file

Parameters
isom_filetarget ISOBMF file
chap_filetarget chapter file
import_fpsspecifies the chapter frame rate (optional, ignored if 0 - defaults to 25). Most formats don't use this feature
for_qtuse QT signaling for chapter tracks
Returns
error if any

◆ gf_media_make_isma()

GF_Err gf_media_make_isma ( GF_ISOFile isom_file,
Bool  keepESIDs,
Bool  keepImage,
Bool  no_ocr 
)

Make the file ISMA compliant: creates ISMA BIFS / OD tracks if needed, and update audio/video IDs the file should not contain more than one audio and one video track

Parameters
isom_filethe target ISOBMF file
keepESIDsif true, ES IDs are not changed.
keepImageif true, keeps image tracks
no_ocrif true, doesn't write clock references in MPEG-4 system info
Returns
error if any

◆ gf_media_make_3gpp()

GF_Err gf_media_make_3gpp ( GF_ISOFile isom_file)

Make the file 3GP compliant && sets profile

Parameters
isom_filethe target ISOBMF file
Returns
error if any

◆ gf_media_make_psp()

GF_Err gf_media_make_psp ( GF_ISOFile isom_file)

make the file playable on a PSP

Parameters
isom_filethe target ISOBMF file
Returns
error if any

◆ gf_media_check_qt_prores()

GF_Err gf_media_check_qt_prores ( GF_ISOFile qt_file)

adjust file params for QT prores

Parameters
qt_filethe target QT file
Returns
error if any