====== Carl ====== * [[https://www.matroska.org/technical/index.html]] * [[https://www.codecguide.com/klcp_ability_comparison.htm]] - список поддерживаемых кодеков (втч и G.7xx) * [[https://en.wikipedia.org/wiki/MPEG-4_Part_14]] * [[https://naudio.codeplex.com/|NAudio]] * [[wpru>Профили данных RTP]] * [[wp>RTP audio video profile]] * [[https://gstreamer.freedesktop.org/documentation/index.html|GStreamer]] * [[https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rtpg722depay.html|rtpg722depay]] Extracts G722 audio from RTP packets * [[http://sox.sourceforge.net/soxformat.html|SoX]] * [[https://osqa-ask.wireshark.org/questions/26607/coverting-g722-payload-to-wav]] * [[https://osqa-ask.wireshark.org/questions/21193/extracting-rtp-payload-and-dumping-to-a-ts-file|Extracting RTP payload and dumping to a ts file]] * https://documentation.media5corp.com/display/DGWLATEST/How+to+Decode+and+Playback+G729+Audio+Streams * samples * [[http://www-mobile.ecs.soton.ac.uk/hth97r/links/demo.html|Demo of Wideband Speech Coding]] * [[http://www.signalogic.com/index.pl?page=codec_samples]] * [[https://ffmpeg.org/pipermail/libav-user/2016-September/009729.html|G.711 audio in mkv container]] * [[https://stackoverflow.com/questions/47460318/write-h264-g-711g-722-g-726-to-mkv|Write h264 + g.711(g.722,g.726) to mkv]] ===== Audio Channel Manipulation ===== * [[https://trac.ffmpeg.org/wiki/AudioChannelManipulation]] ===== Пример G.711 в mka ===== По описанию тут https://lists.libav.org/pipermail/libav-user/2009-September/003809.html Файл **32.mp3** взят отсюда http://www.kozco.com/tech/soundtests.html Преобразование: $ ffmpeg -i 32.mp3 -acodec pcm_alaw -ac 1 -ar 8000 -ab 40000 32.mka ffmpeg version 3.2.5-1~bpo8+1 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 4.9.2 (Debian 4.9.2-10) configuration: --prefix=/usr --extra-version='1~bpo8+1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --disable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 Input #0, mp3, from '32.mp3': Duration: 00:00:32.05, start: 0.025057, bitrate: 128 kb/s Stream #0:0: Audio: mp3, 44100 Hz, mono, s16p, 128 kb/s Metadata: encoder : LAME3.98r Output #0, matroska, to '32.mka': Metadata: encoder : Lavf57.56.101 Stream #0:0: Audio: pcm_alaw ([6][0][0][0] / 0x0006), 8000 Hz, mono, s16, 64 kb/s Metadata: encoder : Lavc57.64.101 pcm_alaw Stream mapping: Stream #0:0 -> #0:0 (mp3 (native) -> pcm_alaw (native)) Press [q] to stop, [?] for help size= 259kB time=00:00:32.00 bitrate= 66.4kbits/s speed= 790x video:0kB audio:250kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.681250% Выдача MediaInfo: General Unique ID : 17719613707446459289158434415458592130 (0xD54AC6826989681F1A8D31D845F2582) Complete name : C:\zorin\Fedor\CaRL\my-tests\32.mka Format : Matroska Format version : Version 4 / Version 2 File size : 259 KiB Duration : 32 s 0 ms Overall bit rate : 66.4 kb/s Writing application : Lavf57.56.101 Writing library : Lavf57.56.101 ErrorDetectionType : Per level 1 Audio ID : 1 Format : ADPCM Format profile : A-Law Codec ID : A_MS/ACM / 6 Codec ID/Hint : CCITT Duration : 32 s 0 ms Bit rate : 64.0 kb/s Channel(s) : 1 channel Sampling rate : 8 000 Hz Bit depth : 8 bits / 8 bits Stream size : 250 KiB (96%) Writing library : Lavc57.64.101 pcm_alaw Default : Yes Forced : No ===== Воспроизведение нескольких аудио-дорожек ===== * [[https://toster.ru/q/5442]] * Аудиодорожки — VLC, например. Media — Advanced Open File — Show more options. * В данном случае поможет BSPlayer — в «Audio streams» в окошке «Audio stream selection» указываете какие дорожки видеофайла BSPlayer должен играть одновременно. ===== Представление кодеков ===== в matroska * TrackEntry.CodecID = ''A_MS/ACM'' * TrackEntry.CodecPrivate для ''A_MS/ACM'' содержит структуру ''WAVEFORMATEX'' [[https://msdn.microsoft.com/ru-ru/library/windows/desktop/dd390970(v=vs.85).aspx|Описание структуры WAVEFORMATEX]] typedef struct { WORD wFormatTag; WORD nChannels; DWORD nSamplesPerSec; DWORD nAvgBytesPerSec; WORD nBlockAlign; WORD wBitsPerSample; WORD cbSize; } WAVEFORMATEX; wFormatTag - A complete list of format tags can be found in the [[https://github.com/google/sagetv/blob/master/third_party/mplayer/loader/wine/mmreg.h|Mmreg.h]] header file #define WAVE_FORMAT_ALAW 0x0006 /* Microsoft Corporation */ #define WAVE_FORMAT_MULAW 0x0007 /* Microsoft Corporation */ #define WAVE_FORMAT_G723_ADPCM 0x0014 /* Antex Electronics Corporation */ #define WAVE_FORMAT_G721_ADPCM 0x0040 /* Antex Electronics Corporation */ #define WAVE_FORMAT_G728_CELP 0x0041 /* Antex Electronics Corporation */ #define WAVE_FORMAT_G726_ADPCM 0x0064 /* APICOM */ #define WAVE_FORMAT_G722_ADPCM 0x0065 /* APICOM */ #define WAVE_FORMAT_G729A 0x0083 /* AT&T Labs, Inc. */ #define WAVE_FORMAT_DF_G726 0x0085 /* DataFusion Systems (Pty) (Ltd) */ #define WAVE_FORMAT_DF_GSM610 0x0086 /* DataFusion Systems (Pty) (Ltd) */ ===== Opus ===== * [[https://matroska.org/news/opus_additions.html]] * [[https://wiki.xiph.org/MatroskaOpus]] * [[https://tools.ietf.org/html/rfc7845|rfc 7845]] Ogg Encapsulation for the Opus Audio Codec * [[http://forum.doom9.org/showthread.php?t=167854]] If MKVToolnix can mux Opus into Matroska file now * [[https://dl.dropboxusercontent.co m/u/1332083/265opus.mkv|[Q] Cant play an mkv with opus audio]] * Audio ID : 2 Format : Opus Codec ID : A_OPUS Duration : 9mn 28s Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz Compression mode : Lossy Title : Track 1 Default : Yes Forced : No ===== RTP ===== ==== RTP Timestamp ==== * [[https://stackoverflow.com/questions/24658525/how-to-calculate-the-rtp-timestamp-for-each-packet-in-an-audio-stream|How to calculate the RTP Timestamp for each packet in an audio stream]] * Audio RTP payload formats typically uses an 8Khz clock. Then take the first audio sample containing e.g. 20ms and assign this timestamp t = 0. 20 ms is a 1/50 of a second, hence this equals a 8000/50 = 160 timestamp increment for the following sample. In the case of audio you can calculate the sample duration based on the sample rate, bits per sample, and number of channels. In the case of a live source, the sample might be timestamped already, and you simply have to translate the timestamp to an RTP timestamp. * A good reference for RTP in general can be found in the Colin Perkins book, [[http://csperkins.org/standards/rtp-book.html|RTP - Audio and video for the Internet]]. While some of the information might be outdated, it will give you a good understanding of RTP. ==== RTP Payload Type ==== Типы определены тут: [[ruwp>Профили данных RTP]] ==== Пример создания KaxSimpleBlock ==== https://github.com/neolynx/tvdaemon/blob/master/lib/Matroska.cpp KaxSimpleBlock &simpleblock = AddNewChild( *cluster ); //KaxSimpleBlock *simpleblock = new KaxSimpleBlock( ); simpleblock.SetParent( *cluster ); simpleblock.AddFrame( *track, ts * timecode_scale, *frame, LACING_EBML ); simpleblock.SetKeyframe( type == DVB_MPEG_ES_FRAME_I ); simpleblock.SetDiscardable( type == DVB_MPEG_ES_FRAME_B ); //KaxBlockBlob *blob = new KaxBlockBlob( BLOCK_BLOB_ALWAYS_SIMPLE ); //blob->SetParent( *cluster ); //blob->AddFrameAuto( *track, ts * timecode_scale, *frame, LACING_EBML ); ////blob->SetBlockDuration( 50 * timecode_scale ); //cluster->AddBlockBlob( blob ); //cues.AddBlockBlob( simpleblock ); //WriteSegment( ); ==== SIP ==== Библиотеки * [[wp>oSIP]] * https://www.gnu.org/software/osip/ * [[https://www.gnu.org/software/osip/doc/html/modules.html|docs]] * [[http://staskobzar.blogspot.ru/2017/07/sip-stack-libre-creating-simple-options.html|SIP stack libre: creating simple OPTIONS SIP request]] * [[http://creytiv.com/re.html|libre]] * [[http://sofia-sip.sourceforge.net/|Sofia-SIP]] * [[http://www.pjsip.org/|PJSIP]] * [[http://www.antisip.com/doc/exosip2/|libeXosip2]] * [[https://www.resiprocate.org/Main_Page|reSIProcate]] * [[http://www.linphone.org/technical-corner/belle-sip/overview|bell-sip]] ==== FFmpeg ==== * [[https://habr.com/ru/company/edison/blog/495614/|Руководство по FFmpeg libav]] - [[https://github.com/leandromoreira/ffmpeg-libav-tutorial|Оригинал:Описание к проекту на github]] * [[https://slhck.info/ffmpeg-encoding-course/#/|Слайды презентации FFMPEG ENCODING AND EDITING COURSE]] * https://github.com/imkira/go-libav * [[wp>Foreign function interface]] - FFI, упоминается в статьях * https://golang.org/cmd/cgo/ * https://github.com/giorgisio/goav - возможная альтернатива * https://github.com/3d0c/gmf * https://github.com/xfrr/goffmpeg - обертка вокруг исполняемого ffmpeg