Пример #1
0
        private static void SetAudioFormat(MPlaylistClass mplaylist, string formatName)
        {
            int count = 0;

            mplaylist.FormatAudioGetCount(eMFormatType.eMFT_Convert, out count);
            int index = -1;

            MPLATFORMLib.M_AUD_PROPS audProps = new MPLATFORMLib.M_AUD_PROPS();
            string name;

            for (int i = 0; i < count; i++)
            {
                mplaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, i, out audProps, out name);
                if (string.Equals(name, formatName, StringComparison.OrdinalIgnoreCase))
                {
                    index = i;
                    break;
                }
            }

            if (index >= 0)
            {
                mplaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps);
            }
        }
Пример #2
0
        private void ConfigPlaylist()
        {
            MItem myBack;

            m_objMPLaylist.PlaylistBackgroundSet(null, "", "", out myBack);
            if (myBack != null)
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(myBack);
                GC.Collect();
            }
            // set convert format
            M_VID_PROPS mvid;
            M_AUD_PROPS maud;
            int         fmtind;
            string      fmtname;

            m_objMPLaylist.FormatVideoGet(eMFormatType.eMFT_Output, out mvid, out fmtind, out fmtname);
            m_objMPLaylist.FormatAudioGet(eMFormatType.eMFT_Output, out maud, out fmtind, out fmtname);
            m_objMPLaylist.FormatVideoSet(eMFormatType.eMFT_Convert, ref mvid);
            m_objMPLaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref maud);

            // set properties
            m_objMPLaylist.PropsSet("loop", "false");
            m_objMPLaylist.PropsSet("active_frc", "false");
            m_objMPLaylist.PropsSet("preview.drop_frames", "true");

            M_VID_PROPS vidProps = new M_VID_PROPS();

            vidProps.eVideoFormat = eMVideoFormat.eMVF_Custom;
            m_objMPLaylist.FormatVideoSet(eMFormatType.eMFT_Convert, ref vidProps);
        }
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            M_AUD_PROPS audProps = new M_AUD_PROPS();
            string      strFormat;

            myPlaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, comboBox2.SelectedIndex, out audProps, out strFormat);
            //Set new audio format
            myPlaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps);
        }
Пример #4
0
        private static void SetAudioFormat(MPlaylistClass mplaylist, string formatName)
        {
            int count = 0;

            mplaylist.FormatAudioGetCount(eMFormatType.eMFT_Convert, out count);
            int index = -1;

            MPLATFORMLib.M_AUD_PROPS audProps = new MPLATFORMLib.M_AUD_PROPS();
            string name;

            for (int i = 0; i < count; i++)
            {
                mplaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, i, out audProps, out name);
                if (string.Equals(name, formatName, StringComparison.OrdinalIgnoreCase))
                {
                    index = i;
                    break;
                }
            }

            if (index >= 0)
            {
                mplaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps);
            }

            //MPLATFORMLib.M_AUD_PROPS m_AUD_PROPS = default(MPLATFORMLib.M_AUD_PROPS);
            //if (info.AudioFormat > 0)
            //{
            //    string text;
            //    mplaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, info.AudioFormat, out m_AUD_PROPS, out text);
            //}
            //else
            //{
            //    m_AUD_PROPS.nSamplesPerSec = 48000;
            //    m_AUD_PROPS.nChannels = 2;
            //    m_AUD_PROPS.nBitsPerSample = 16;
            //}
            //mplaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref m_AUD_PROPS);
        }
Пример #5
0
        void StartBug()
        {
            // playlist initialization

            M_VID_PROPS vidProps = new M_VID_PROPS();

            vidProps.eVideoFormat = eMVideoFormat.eMVF_Custom;
            MPlaylist.FormatVideoSet(eMFormatType.eMFT_Convert, ref vidProps);
            M_AUD_PROPS audioProp = new M_AUD_PROPS();

            audioProp.nChannels = 0;   //because some writer codecs (such as mp3) do not support 16 audio channels.
            MPlaylist.FormatAudioSet(eMFormatType.eMFT_Convert, audioProp);

            // playlist cue
            //set empty background. In this case playlist doesn't output anything until playback isn't started.
            MItem myBack;

            MPlaylist.PlaylistBackgroundSet(null, "", "", out myBack);
            if (myBack != null)
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(myBack);
                GC.Collect();
            }
            // set convert format
            M_VID_PROPS mvid;
            M_AUD_PROPS maud;
            int         fmtind;
            string      fmtname;

            MPlaylist.FormatVideoGet(eMFormatType.eMFT_Output, out mvid, out fmtind, out fmtname);
            MPlaylist.FormatAudioGet(eMFormatType.eMFT_Output, out maud, out fmtind, out fmtname);
            MPlaylist.FormatVideoSet(eMFormatType.eMFT_Convert, ref mvid);
            MPlaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref maud);
            // set properties
            MPlaylist.PropsSet("loop", "false");
            MPlaylist.PropsSet("active_frc", "false");
            MPlaylist.PropsSet("preview.drop_frames", "true");
            vidProps.eVideoFormat = eMVideoFormat.eMVF_Custom;
            MPlaylist.FormatVideoSet(eMFormatType.eMFT_Convert, ref vidProps);

            int   index = -1;
            MItem item;

            MPlaylist.PlaylistAdd(null, @"\\192.168.0.100\MLFiles\Trash\Roman\WorkFiles\FilesFromCostumer\2019.05.27 Etere31929\kom_mult_kosmik_007sh_s.mpg", "", ref index, out item);

            // writer properties
            MWriter.PropsSet("rate_control", "true");
            MWriter.PropsSet("pull_mode", "false");
            MWriter.PropsSet("external_process", "false");

            //set audio mapping on first 2 channels only
            string       desc;
            IMAudioTrack audioTrack;

            MPlaylist.AudioTrackGetByIndex(0, out desc, out audioTrack);

            int nChIn;
            int nChOutIdx;
            int nChOut;

            audioTrack.TrackChannelsGet(out nChIn, out nChOutIdx, out nChOut);
            for (int i = 0; i < nChOut; i++)
            {
                int mute;
                if (i < 2)
                {
                    // switch on the required audio channels
                    mute = 0;
                }
                else
                {
                    // set mute all other audio channels
                    mute = 1;
                }
                audioTrack.TrackMuteSet(i, mute, 0.0);
            }

            string encodeConfig = @"format='mp4' start_timecode='00:00:00:00' video::codec='q264sw' video::size='640x360' video::b='1M' video::minrate='1M' video::maxrate='1M' video::ar='' video::ref_frames='3' video::profile='Baseline' video::level='4.1' video::rc_type='cbr' audio::codec='aac' audio::ar='48000'";

            MWriter.WriterNameSet(@"\\192.168.0.100\MLFiles\Trash\Roman\WorkFiles\FilesFromCostumer\2019.05.27 Etere31929\test\" + count.ToString() + ".mp4", encodeConfig);
            MWriter.ObjectStart(MPlaylist);
            MPlaylist.FilePlayStart();

            Marshal.ReleaseComObject(item);
            //Marshal.ReleaseComObject(myBack);
            GC.Collect();
        }