Recherche avancée

Médias (91)

Autres articles (15)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

Sur d’autres sites (4844)

  • Using ffmpeg with Python 2.7

    1er juillet 2015, par suffa

    I have been trying to install pyffmpeg in Python 2.7 unsuccessfully. I found a package for Python 2.6, but I can’t get it to work. So, I have been mulling around with 2.7. I’ve seen previous post from others on this site, but they have not helped. Does anyone have experience with this. Ultimately, I want to develop an wxPython app that converts video formats. Thanks

    Code that I ultimately wrote that worked for me (very rudimentary, but it works ....) :

    import wx
    import os
    import sys
    import time
    import datetime
    from wx.lib.delayedresult import startWorker



    class dConvert(wx.Frame):
       def __init__(self):
           wx.Frame.__init__(self, None, -1, 'd-Converter', size=(500, 310))
           panel = wx.Panel(self, wx.ID_ANY)#Creates a panel over the widget
           toolbar = self.CreateToolBar()
           toolbar.Realize()

           #Setup Menu
           #Setting up Menu
           menuFile = wx.Menu()
           menuFile.Append(1, "&About...")
           menuFile.AppendSeparator()
           menuFile.Append(2, "E&xit")
           menuBar = wx.MenuBar()
           menuBar.Append(menuFile, "&File")

           panel.SetBackgroundColour('WHITE')

           menu2 = wx.Menu()
           menu2.Append(5, "&.mpg to dvd", ".mpg to dvd")
           menu2.AppendSeparator()
           menu2.Append(wx.NewId(), "&Options...", "Options...")
           menuBar.Append(menu2, "&DVD")


           menu3 = wx.Menu()
           menu3.Append(7, "&Audio/Video Trim")
           #menu3.AppendSeparator()
           menuBar.Append(menu3, "Media")

           self.SetMenuBar(menuBar)
           self.Bind(wx.EVT_MENU, self.OnAbout, id=1)
           self.Bind(wx.EVT_MENU, self.OnQuit, id=2)
           self.Bind(wx.EVT_MENU, self.OnDVD, id=5)
           self.Bind(wx.EVT_MENU, self.OnMedia, id=7)

           #Add icon to frame
           iconFile = "dconverter_image.jpg"
           icon1 = wx.Icon(iconFile, wx.BITMAP_TYPE_JPEG)
           self.SetIcon(icon1)


           self.statusbar = self.CreateStatusBar()
           self.statusbar.SetStatusText("Convert Audio & Video")
           self.statusbar.SetFieldsCount(3)
           self.statusbar.SetStatusWidths([200, -2, -2])



           #Panel Text
           font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
           font2 = wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.BOLD)

           directory = wx.StaticText(panel, -1, 'Path: c:\\ffmpeg\\bin', (300, 13))
           directory.SetFont(font2)

           convertfile = wx.StaticText(panel, -1, 'File:', (270, 53))
           convertfile.SetFont(font)

           convertfile2 = wx.StaticText(panel, -1, 'Format:', (245, 83))
           convertfile2.SetFont(font)

           convertfile3 = wx.StaticText(panel, -1, 'Quality:', (244, 113))
           convertfile3.SetFont(font)

           convertfile4 = wx.StaticText(panel, -1, 'Presets:', (239, 143))
           convertfile4.SetFont(font)

           image_file = 'cd_rom.gif'
           bmp1 = wx.Image(image_file, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
           panel.bitmap1 = wx.StaticBitmap(panel, -1, bmp1, (50, 30))



           self.formats1 = []


           #Select Media path    
           os.chdir("c:\\ffmpeg\\bin")
           wrkdir = os.getcwd()
           filelist = os.listdir(wrkdir)
           #self.formats1 = []

           for filename in filelist:
               (head, filename) = os.path.split(filename)
               if filename.endswith(".avi") or filename.endswith(".mp4") or filename.endswith(".mpg") or filename.endswith(".m4A") or filename.endswith(".MTS") or filename.endswith(".flv") or filename.endswith(".mov") or filename.endswith(".mpeg4") or filename.endswith(".mpeg") or filename.endswith(".mpg2") or filename.endswith(".mkv") or filename.endswith(".m4v") or filename.endswith(".wav") or filename.endswith(".mp3"):
               self.formats1.append(filename)


           self.format_combo1=wx.ComboBox(panel, size=(140, -1),value='Select Media', choices=self.formats1, style=wx.CB_DROPDOWN, pos=(300,50))
           self.Bind(wx.EVT_COMBOBOX, self.fileFormats, self.format_combo1)


           #Media Formats
           self.formats2 = ['Select Format', '.avi','.mpeg','.mp4','.flv','.mov','.m4a','.m4v','.mkv','.mpeg4','.mpg','.mpg2','.mp3','.ogg','.wav','.wma']

           self.format_combo2=wx.ComboBox(panel, size=(100, -1),value='Select Format', choices=self.formats2, style=wx.CB_SORT, pos=(300,81))

           #Media Quality
           self.formats3 = ['-sameq','-qmax']
           self.format_combo3=wx.ComboBox(panel, size=(100, -1),value='Select Quality', choices=self.formats3, style=wx.CB_DROPDOWN, pos=(300,111))



           #-qmax settings
           self.formats4 = ['1','2','3','4','5','6','7','8']
           self.format_combo4=wx.ComboBox(panel, size=(30, -1),value='0', choices=self.formats4, style=wx.CB_DROPDOWN, pos=(405,111))
           self.format_combo4.Disable()


           #Media Quality
           self.formats5 = ['Select Preset','video to mp3']
           self.format_combo5=wx.ComboBox(panel, size=(100, -1),value='Select Preset', choices=self.formats5, style=wx.CB_DROPDOWN, pos=(300,141))

           #Bit rate
           self.formats6 = ['128000', '160000', '180000', '192000']
           self.format_combo6=wx.ComboBox(panel, size=(47, -1),value='k/bs', choices=self.formats6, style=wx.CB_DROPDOWN, pos=(405,141))
           self.format_combo6.Disable()






           #Convert Button
           self.button = wx.Button(panel, label="Convert", pos=(300, 171), size=(80, 20))
           self.Bind(wx.EVT_BUTTON, self.convertButton, self.button)

           #Abort Button
           self.button2 = wx.Button(panel, label="Abort", pos=(385, 171), size=(80, 20))
           self.Bind(wx.EVT_BUTTON, self.OnAbortButton, self.button2)
           self.button2.Disable()

           #Refresh Button
           self.button3 = wx.Button(panel, label="Refresh", pos=(215, 171), size=(80, 20))
           self.Bind(wx.EVT_BUTTON, self.file_refresh, self.button3)


           #ComboBox Event
           self.Bind(wx.EVT_COMBOBOX, self.OncomboBox, self.format_combo3)
           self.Bind(wx.EVT_COMBOBOX, self.OncomboBox2, self.format_combo5)
           self.Bind(wx.EVT_COMBOBOX, self.OncomboBox3, self.format_combo2)



       def file_refresh(self, e):
           self.format_combo1.Clear()
           os.chdir("c:\\ffmpeg\\bin")
           wrkdir = os.getcwd()
           filelist = os.listdir(wrkdir)
           for m_files in filelist:
               if m_files.endswith(".avi") or m_files.endswith(".mp4") or m_files.endswith(".mpg") or m_files.endswith(".m4A") or m_files.endswith(".MTS") or m_files.endswith(".flv") or m_files.endswith(".mov") or m_files.endswith(".mpeg4") or m_files.endswith(".mpeg") or m_files.endswith(".mpg2") or m_files.endswith(".mkv") or m_files.endswith(".m4v") or m_files.endswith(".wav") or m_files.endswith(".mp3"):
               self.format_combo1.Append(m_files)



       def file_rename(self, f_name):
           ts = time.time()
           #Capture readable timestamp
           st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H-%M-%S')
           os.chdir("c:\\ffmpeg\\bin")
           wrkdir = os.getcwd()

           #get file extenstion from original file
           #fileName, fileExtension = os.path.splitext(wrkdir + '\\' + f_name)

           #add file extension to timestamp
           new_file = st

           return new_file



       def fileFormats(self, e):
           myFormats = {'audio': ('Select Format', '.m4a', '.mp3', '.ogg', '.wav', '.wma'), 'video': ('Select Format', '.avi', '.flv', '.mkv', '.m4v', '.mov', '.mpg', '.mpg2', '.mpeg4', '.mp4', '.mpeg')}
           bad_file = ['Media not supported']
           myFile = self.format_combo1.GetValue()
           f_exten = (x for x in myFormats['audio'] + myFormats['video'] if myFile.endswith(x))
       extension = f_exten.next()

           if extension in myFormats['audio']:
               self.format_combo2.SetItems(myFormats['audio'])

           elif extension in myFormats['video']:
               self.format_combo2.SetItems(myFormats['video'])
           else:
               self.format_combo2.SetItems(bad_file)


       def OnQuit(self, event):
           self.Close(True)

       def OnAbout(self, event):
           wx.MessageBox("d-Converter 1.0\n\n Developer: D.Monroe\n\nCopyright 2012",
                   "About d-Converter", wx.OK | wx.ICON_INFORMATION, self)


       def OncomboBox(self, e):
           quality=self.format_combo3.GetValue()
           if quality == '-qmax':
               self.format_combo4.Enable()

           else:
               self.format_combo4.Disable()



       def OncomboBox2(self, e):
           quality=self.format_combo5.GetValue()
           if quality != 'Select Preset':
               self.format_combo1.Enable()
               self.format_combo2.Disable()
               self.format_combo3.Disable()
               self.format_combo4.Disable()
               self.format_combo6.Enable()

           elif quality == 'Select Preset':
               self.format_combo1.Enable()
               self.format_combo2.Enable()
               self.format_combo3.Enable()
               self.format_combo4.Disable()
               self.format_combo5.Enable()
               self.format_combo6.Disable()

           elif quality == 'video to mp3':
               self.format_combo6.Enable()
               self.format_combo2.Disable()
               self.format_combo3.Disable()
               self.format_combo4.Disable()

       def OncomboBox3(self, e):
           v_format=self.format_combo2.GetValue()
           if v_format != 'Select Format':
               self.format_combo1.Enable()
               self.format_combo2.Enable()
               self.format_combo3.Enable()
               self.format_combo4.Enable()
               self.format_combo5.Disable()
               self.format_combo6.Disable()

           elif v_format == 'Select Format':
               self.format_combo1.Enable()
               self.format_combo2.Enable()
               self.format_combo3.Enable()
               self.format_combo4.Disable()
               self.format_combo5.Enable()
               self.format_combo6.Disable()





       def OnMedia(self, e):
           pass

       def OnDVD(self, e):
           """ Select a directory to search"""
           os.chdir("c:\\ffmpeg\\bin")
           wrkdir = os.getcwd()
           filelist = os.listdir(wrkdir)
           progdir = 'c:\\ffmpeg\\bin\\ffmpeg.exe' + ' -i '
           prog_dir = ' -target '
           progdir3 = '-dvd -ac 2 '
           vid_format = '.mpg'


           sampleList = []
           for filename in filelist:
              (head, filename) = os.path.split(filename)
              if filename.endswith(".avi") or filename.endswith(".flv") or filename.endswith(".mpeg") or filename.endswith(".mp4") or filename.endswith(".mov") or filename.endswith(".mpg2"):
               sampleList.append(filename)

           dlg = wx.SingleChoiceDialog(
                  self, "Files in c:\\ffmpeg\\bin", 'Select video to convert',
              sampleList,
              wx.CHOICEDLG_STYLE
              )

           if dlg.ShowModal() == wx.ID_OK:
               cur_item = dlg.GetStringSelection()
               s_string = cur_item
               #f_string = self.file_rename(s_string)
               f_string = s_string.replace(' ', '')





           dlg.Destroy()


           dlg2 = wx.SingleChoiceDialog(
                  self, "Files in c:\\ffmpeg\\bin", 'Select video standard ',
              ["pal", "ntsc"],
              wx.CHOICEDLG_STYLE
              )

           if dlg2.ShowModal() == wx.ID_OK:
               cur_item2 = dlg2.GetStringSelection()
               s_string2 = cur_item2
               self.button.Disable()
               self.button2.Enable()
               self.format_combo1.Disable()
               self.format_combo2.Disable()
               self.format_combo3.Disable()
               self.format_combo4.Disable()
               self.format_combo5.Disable()
               self.format_combo6.Disable()
               startWorker(self.LongTaskDone, self.LongTask4, wargs=(progdir, wrkdir, prog_dir, progdir3, f_string, s_string2, vid_format))


           dlg2.Destroy()






       def convertButton(self, e):
           unit1 = self.format_combo1.GetValue()
           unit2 = self.format_combo2.GetValue()
           unit3 = self.format_combo3.GetValue()
           unit4 = None
           unit5 = self.format_combo5.GetValue()
           bitRate = self.format_combo6.GetValue()
           unit6 = bitRate
           if unit3 == '-qmax':
               unit4 = self.format_combo4.GetValue()
           else:
               pass

           os.chdir("c:\\ffmpeg\\bin")
           wrkdir = os.getcwd()

           newfile = unit1



           #stripped = os.path.splitext(newfile)[0] # Updated 9/26/2013 to strip extension.
           #stripped = newfile.strip('mpeg3kaviovfl4w2c.') #Strips the extension from the original file name
           stripped = self.file_rename(newfile)

           #os.rename(newfile, newfile_f)



           progname='c:\\ffmpeg\\bin\\ffmpeg.exe' + ' -i '

           preset1_a='-vn -ar 44100 -ac 2 -ab'
           preset1_b='-f mp3 '
           preset_mp3='.mp3'







            if (unit1 == 'Select Media' or unit1 == ''):
                       amsg = wx.MessageDialog(None, 'You must select a media file!', 'Media Converter', wx.ICON_INFORMATION)
                       amsg.ShowModal()
                       amsg.Destroy()



            elif (unit1 != 'Select Media' or unit1 != '') and (unit5 == 'Select Preset'):

                if (unit2 == 'Select Format' or unit2 == ''):
                   amsg = wx.MessageDialog(None, 'You must select a format', 'Media Converter', wx.ICON_INFORMATION)
                   amsg.ShowModal()
                   amsg.Destroy()

                   self.format_combo3.Enable()
                   self.format_combo4.Enable()
                   self.format_combo5.Enable()

               else:
                   pass

               if (unit3 == 'Select Quality' or unit3 == ''):
                   amsg = wx.MessageDialog(None, 'You must select quality', 'Media Converter', wx.ICON_INFORMATION)
                   amsg.ShowModal()
                   amsg.Destroy()


               elif (unit3 == '-qmax'):
                   if (unit4 == '0' or unit4 == ''):
                       amsg = wx.MessageDialog(None, 'You must select number between 1-8.', 'Media Converter', wx.ICON_INFORMATION)
                       amsg.ShowModal()
                       amsg.Destroy()
                   else:
                       self.button.Disable()
                       self.button2.Enable()
                       pass

               else:
                   self.button.Disable()
                   self.button2.Enable()
                   self.format_combo1.Disable()
                   self.format_combo2.Disable()
                   self.format_combo3.Disable()
                   self.format_combo4.Disable()
                   startWorker(self.LongTaskDone, self.LongTask, wargs=(progname,wrkdir,unit1,unit3,stripped,unit2))





           elif (unit1 != 'Select Media' or unit1 != '') and (unit5 == 'video to mp3'):
               if unit6 == 'k/bs' or unit6 == None:
                   amsg = wx.MessageDialog(None, 'You must select a bit rate.', 'Media Converter', wx.ICON_INFORMATION)
                   amsg.ShowModal()
                   amsg.Destroy()

               else:
                   self.button.Disable()
                   self.button2.Enable()
                   self.format_combo1.Disable()
                   self.format_combo2.Disable()
                   self.format_combo3.Disable()
                   self.format_combo4.Disable()
                   self.format_combo5.Disable()
                   self.format_combo6.Disable()
                   startWorker(self.LongTaskDone, self.LongTask3, wargs=(progname, wrkdir, unit1, preset1_a, unit6, preset1_b, stripped, preset_mp3))











       def LongTask(self, progname, wrkdir, unit1, unit3, stripped, unit2):
           convert_file1 = progname + wrkdir + '\\' + unit1 + ' ' + unit3 + ' ' + stripped + unit2
           self.statusbar.SetStatusText("Converting: " + unit1 + "...")
           os.system(convert_file1)
           print convert_file1





       def LongTask2(self, progname, wrkdir, unit1, unit3, unit4, stripped, unit2):
           convert_file2 = progname + wrkdir + '\\' + unit1 + ' ' + unit3 + ' ' + unit4 + ' ' + stripped + unit2
           self.statusbar.SetStatusText("Converting: " + unit1 + "...")
           os.system(convert_file2)


       def LongTask3(self, progname, wrkdir, unit1, preset1_a, unit6, preset1_b, stripped, preset_mp3):
           convert_file3 = progname + wrkdir + '\\' + unit1 + ' ' + preset1_a + ' ' + unit6 + ' ' + preset1_b + stripped + preset_mp3
           self.statusbar.SetStatusText("Converting: " + unit1 + "...")
           os.system(convert_file3)

       def LongTask4(self, progdir, wrkdir, prog_dir, progdir3, f_string, s_string2, vid_format):
           #convert_file4 = progdir + wrkdir + '\\' + s_string + prog_dir + s_string2 + progdir3 + s_string.strip('mpegaviw24ofl.') + vid_format
           convert_file4 = progdir + f_string + prog_dir + s_string2 + progdir3 + f_string.strip('mpegaviw24ofl.') + vid_format
           self.statusbar.SetStatusText("Converting: " + f_string + "...")
           os.system(convert_file4)
           print convert_file4



       def LongTaskDone(self, result):
           r = result.get()
           if r:
               amsg = wx.MessageDialog(None, 'Aborted!', 'Media Converter', wx.ICON_INFORMATION)
               self.statusbar.SetStatusText("Convert Aborted ...")
               amsg.ShowModal()
               amsg.Destroy()
               self.LongTask.terminate()
           else:
               self.statusbar.SetStatusText("Done ...")
               emsg = wx.MessageDialog(None, 'Finished Converting!', 'Media Converter', wx.ICON_INFORMATION)
               emsg.ShowModal()
               emsg.Destroy()
               self.format_combo1.Enable()
               self.format_combo2.Enable()
               self.format_combo3.Enable()
               self.format_combo5.Enable()
               self.format_combo4.Disable()
               self.format_combo6.Disable()
               self.button.Enable()
               self.button2.Disable()
               self.shouldAbort = False
           """self.progress_bar.SetValue(0)
           self.progress_bar.Hide()"""



       def OnAbortButton(self, e):
           endprogram = 'c:\\Windows\\System32\\taskkill /IM cmd.exe'
           os.system(endprogram)
           self.format_combo1.Enable()
           self.format_combo2.Enable()
           self.format_combo3.Enable()
           self.format_combo5.Enable()
           self.button.Enable()




    if __name__ == '__main__':
       app = wx.PySimpleApp()
       frame = dConvert()
       frame.SetSizeHints(500,310,500,310)
       frame.Show()
       app.MainLoop()
  • ffmpeg HLS creation and segmentation results in "cannot decode" on iPad

    5 mai 2014, par jt_dylan

    I have the following code that plays on Mac Safari :

       
         
         
         

       <video controls="controls" width="480" height="270">
       
       <source src="http://d1ckv7o9k6o3x9.cloudfront.net/d54cfa01-eff2-4e86-946e-dc8b2ee4a7e8/media/  hls/MVI_5927.m3u8">
       </source></video>

    The url can be cut/pasted into the browser and works also but neither this code nor the url works in Windows Safari or iPad. Specifically on iPad I receive a cannot decode error. On Mac I have Quicktime installed so I tried that on Windows with no luck. The link that can be play on Mac is below.

    http://d1ckv7o9k6o3x9.cloudfront.net/d54cfa01-eff2-4e86-946e-dc8b2ee4a7e8/media/hls/MVI_5927.m3u8

    Browser Versions of software :
    Mac Safari : Version 7.0.3 (9537.75.14) (works)
    Windows Safari : Version 5.1.7 (7534.7.2) (doesn’t work - blank screen)
    iPad Safari : ios Version 7.1.1 (doesn’t work - cannot decode)

    Here is how I’m creating my mp4 (lgpl)
    I’m creating an mp4 with this command :
    ffmpeg -i input.mov c:v mpeg4 q:v 1 test.mp4

    I’m creating the hls using ffmpeg lpgl with this command :

    ffmpegcmd -re -y -i test.mp4 -map 0 -f segment -segment_list test.m3u8 -segment_list_flags +live -segment_time 1 -segment_list_type m3u8 test%05d.ts 2>&amp;1

    Now this works in Mac Safari with Quicktime installed but results in "cannot decode" if I try the url from ipad Safari.

    I then tried with libx264 to create the mp4 as h.264 with aac and then copy to mpeg2 container as follows :

    ffmpeg -i test.mov  -c:v libx264 -c:a libfdk_aac -preset slower -b:a 240k test.slower.mp4
    ffmpeg -i test.slower.mp4 -vcodec copy -f mpegts -bsf h264_mp4toannexb test.slower.ts
    ffmpeg -re -y -i test.slower.ts -map 0 -f segment -segment_list test.slower.m3u8 -segment_list_flags +live -segment_time 1 -segment_list_type m3u8 test.slower.%05d.ts

    This still produces the same results. Any idea what is wrong here ?

    Any help is much appreciated.

    Regards,
    jt_dylan

    Output from libx264 commands below :

    ffmpeg -i test.mov  -c:v libx264 -c:a libfdk_aac -preset slower -b:a 240k test.slower.mp4

    ffmpeg version git-2014-05-04-aeeb3d4 Copyright (c) 2000-2014 the FFmpeg developers
     built on May  4 2014 17:01:19 with gcc 4.6.3 (GCC) 20120306 (Red Hat 4.6.3-2)
     configuration: --prefix=/home/ec2-user/ffmpeg_build --extra-cflags=-I/home/ec2-user/ffmpeg_build/include --extra-ldflags=-L/home/ec2-user/ffmpeg_build/lib --bindir=/home/ec2-user/bin --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
     libavutil      52. 81.100 / 52. 81.100
     libavcodec     55. 60.103 / 55. 60.103
     libavformat    55. 37.102 / 55. 37.102
     libavdevice    55. 13.101 / 55. 13.101
     libavfilter     4.  5.100 /  4.  5.100
     libswscale      2.  6.100 /  2.  6.100
     libswresample   0. 18.100 /  0. 18.100
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tst/MVI_1716.MOV':
     Metadata:
       major_brand     : qt  
       minor_version   : 537331968
       compatible_brands: qt  CAEP
       creation_time   : 2012-07-21 05:17:44
     Duration: 00:00:20.06, start: 0.000000, bitrate: 34471 kb/s
       Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuvj420p(pc, smpte170m), 1920x1080, 33663 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
       Metadata:
         creation_time   : 2012-07-21 05:17:44
       Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, mono, s16, 768 kb/s (default)
       Metadata:
         creation_time   : 2012-07-21 05:17:44
    No pixel format specified, yuvj420p for H.264 encoding chosen.
    Use -pix_fmt yuv420p for compatibility with outdated media players.
    [libx264 @ 0x39ae9e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x39ae9e0] profile High, level 5.0
    [libx264 @ 0x39ae9e0] 264 - core 142 r2 ac76440 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=8 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'tstconv/MVI_1716.slower.mp4':
     Metadata:
       major_brand     : qt  
       minor_version   : 537331968
       compatible_brands: qt  CAEP
       encoder         : Lavf55.37.102
       Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p, 1920x1080, q=-1--1, 24k tbn, 23.98 tbc (default)
       Metadata:
         creation_time   : 2012-07-21 05:17:44
       Stream #0:1(eng): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, mono, s16, 240 kb/s (default)
       Metadata:
         creation_time   : 2012-07-21 05:17:44
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 -> libx264)
     Stream #0:1 -> #0:1 (pcm_s16le -> libfdk_aac)
    Press [q] to stop, [?] for help
    frame=  481 fps=1.5 q=-1.0 Lsize=   18428kB time=00:00:20.07 bitrate=7519.9kbits/s    
    video:17827kB audio:589kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.060811%
    [libx264 @ 0x39ae9e0] frame I:3     Avg QP:23.31  size:113718
    [libx264 @ 0x39ae9e0] frame P:135   Avg QP:25.06  size: 56912
    [libx264 @ 0x39ae9e0] frame B:343   Avg QP:27.13  size: 29825
    [libx264 @ 0x39ae9e0] consecutive B-frames:  1.2%  4.2% 20.6% 74.0%
    [libx264 @ 0x39ae9e0] mb I  I16..4: 20.0% 53.3% 26.6%
    [libx264 @ 0x39ae9e0] mb P  I16..4:  9.7% 22.8%  5.4%  P16..4: 41.0%  8.6%  5.4%  0.1%  0.0%    skip: 7.0%
    [libx264 @ 0x39ae9e0] mb B  I16..4:  3.3%  7.2%  2.0%  B16..8: 40.7%  9.8%  1.7%  direct: 6.3%  skip:29.0%  L0:49.6% L1:44.7% BI: 5.7%
    [libx264 @ 0x39ae9e0] 8x8 transform intra:58.9% inter:70.2%
    [libx264 @ 0x39ae9e0] direct mvs  spatial:99.4% temporal:0.6%
    [libx264 @ 0x39ae9e0] coded y,uvDC,uvAC intra: 58.6% 46.9% 7.3% inter: 23.9% 20.2% 0.2%
    [libx264 @ 0x39ae9e0] i16 v,h,dc,p: 10% 64% 14% 12%
    [libx264 @ 0x39ae9e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7% 50% 10%  3%  4%  3%  8%  4% 12%
    [libx264 @ 0x39ae9e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  4% 64%  5%  2%  3%  2%  6%  2% 10%
    [libx264 @ 0x39ae9e0] i8c dc,h,v,p: 35% 53%  9%  3%
    [libx264 @ 0x39ae9e0] Weighted P-Frames: Y:11.1% UV:4.4%
    [libx264 @ 0x39ae9e0] ref P L0: 47.8% 12.2% 15.8%  6.8%  5.7%  4.2%  4.3%  2.6%  0.6%  0.0%
    [libx264 @ 0x39ae9e0] ref B L0: 76.8% 10.5%  5.1%  2.9%  2.2%  1.5%  0.9%
    [libx264 @ 0x39ae9e0] ref B L1: 94.6%  5.4%
    [libx264 @ 0x39ae9e0] kb/s:7279.24

    ffmpeg -i test.slower.mp4 -vcodec copy -f mpegts -bsf h264_mp4toannexb test.slower.ts

    ffmpeg version git-2014-05-04-aeeb3d4 Copyright (c) 2000-2014 the FFmpeg developers
     built on May  4 2014 17:01:19 with gcc 4.6.3 (GCC) 20120306 (Red Hat 4.6.3-2)
     configuration: --prefix=/home/ec2-user/ffmpeg_build --extra-cflags=-I/home/ec2-user/ffmpeg_build/include --extra-ldflags=-L/home/ec2-user/ffmpeg_build/lib --bindir=/home/ec2-user/bin --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
     libavutil      52. 81.100 / 52. 81.100
     libavcodec     55. 60.103 / 55. 60.103
     libavformat    55. 37.102 / 55. 37.102
     libavdevice    55. 13.101 / 55. 13.101
     libavfilter     4.  5.100 /  4.  5.100
     libswscale      2.  6.100 /  2.  6.100
     libswresample   0. 18.100 /  0. 18.100
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tstconv/MVI_1716.slower.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf55.37.102
     Duration: 00:00:20.11, start: 0.042667, bitrate: 7508 kb/s
       Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080, 7279 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 240 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    [swscaler @ 0x367c0c0] deprecated pixel format used, make sure you did set range correctly
    Output #0, segment, to 'MVI_1716.slower.%05d.ts':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf55.37.102
       Stream #0:0(eng): Video: mpeg2video, yuv420p, 1920x1080, q=2-31, 200 kb/s, 90k tbn, 23.98 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: mp2, 48000 Hz, mono, s16, 384 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 -> mpeg2video)
     Stream #0:1 -> #0:1 (aac -> mp2)
    Press [q] to stop, [?] for help
    frame=  482 fps= 24 q=31.0 Lsize=N/A time=00:00:20.12 bitrate=N/A dup=1 drop=0    
    video:8293kB audio:944kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 195032183209984.000000%
    ffmpeg version git-2014-05-04-aeeb3d4 Copyright (c) 2000-2014 the FFmpeg developers
     built on May  4 2014 17:01:19 with gcc 4.6.3 (GCC) 20120306 (Red Hat 4.6.3-2)
     configuration: --prefix=/home/ec2-user/ffmpeg_build --extra-cflags=-I/home/ec2-user/ffmpeg_build/include --extra-ldflags=-L/home/ec2-user/ffmpeg_build/lib --bindir=/home/ec2-user/bin --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
     libavutil      52. 81.100 / 52. 81.100
     libavcodec     55. 60.103 / 55. 60.103
     libavformat    55. 37.102 / 55. 37.102
     libavdevice    55. 13.101 / 55. 13.101
     libavfilter     4.  5.100 /  4.  5.100
     libswscale      2.  6.100 /  2.  6.100
     libswresample   0. 18.100 /  0. 18.100
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tstconv/MVI_1716.slower.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf55.37.102
     Duration: 00:00:20.11, start: 0.042667, bitrate: 7508 kb/s
       Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080, 7279 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 240 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    File 'tstconv/MVI_1716.slower.ts' already exists. Overwrite ? [y/N] y
    Output #0, mpegts, to 'tstconv/MVI_1716.slower.ts':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf55.37.102
       Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuvj420p, 1920x1080, q=2-31, 7279 kb/s, 23.98 fps, 90k tbn, 23.98 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: mp2, 48000 Hz, mono, s16, 384 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (aac -> mp2)
    Press [q] to stop, [?] for help
    frame=  481 fps=0.0 q=-1.0 Lsize=   20334kB time=00:00:20.12 bitrate=8276.6kbits/s    
    video:17827kB audio:944kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.325850%

    ffmpeg -re -y -i test.slower.ts -map 0 -f segment -segment_list test.slower.m3u8 -segment_list_flags +live -segment_time 1 -segment_list_type m3u8 test.slower.%05d.ts

    ffmpeg version git-2014-05-04-aeeb3d4 Copyright (c) 2000-2014 the FFmpeg developers
     built on May  4 2014 17:01:19 with gcc 4.6.3 (GCC) 20120306 (Red Hat 4.6.3-2)
     configuration: --prefix=/home/ec2-user/ffmpeg_build --extra-cflags=-I/home/ec2-user/ffmpeg_build/include --extra-ldflags=-L/home/ec2-user/ffmpeg_build/lib --bindir=/home/ec2-user/bin --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
     libavutil      52. 81.100 / 52. 81.100
     libavcodec     55. 60.103 / 55. 60.103
     libavformat    55. 37.102 / 55. 37.102
     libavdevice    55. 13.101 / 55. 13.101
     libavfilter     4.  5.100 /  4.  5.100
     libswscale      2.  6.100 /  2.  6.100
     libswresample   0. 18.100 /  0. 18.100
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, mpegts, from 'tstconv/MVI_1716.slower.ts':
     Duration: 00:00:20.11, start: 1.430733, bitrate: 8282 kb/s
     Program 1
       Metadata:
         service_name    : Service01
         service_provider: FFmpeg
       Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuvj420p(pc), 1920x1080, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
       Stream #0:1[0x101](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, mono, s16p, 373 kb/s
    [swscaler @ 0x1fe9ae0] deprecated pixel format used, make sure you did set range correctly
       Output #0, segment, to 'MVI_1716.slower.%05d.ts':
         Metadata:
           encoder         : Lavf55.37.102
           Stream #0:0: Video: mpeg2video, yuv420p, 1920x1080, q=2-31, 200 kb/s, 90k tbn, 23.98 tbc
           Stream #0:1(eng): Audio: mp2, 48000 Hz, mono, s16, 384 kb/s
       Stream mapping:
         Stream #0:0 -> #0:0 (h264 -> mpeg2video)
         Stream #0:1 -> #0:1 (mp2 -> mp2)
  • How to encode multi audio streams with different options at the same time using ffmpeg

    20 mars 2012, par Luca Borrione

    I'm trying to encode a dvd using ffmpeg.

    $ffmpeg -i VTS_01_1.VOB
    Input #0, mpeg, from &#39;VTS_01_1.VOB&#39;:
    Duration: 00:38:06.52, start: 0.287267, bitrate: 3756 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 9800 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s
    Stream #0:2[0x81]: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s
    Stream #0:3[0x82]: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s
    Stream #0:4[0x83]: Audio: ac3, 48000 Hz, mono, s16, 96 kb/s
    Stream #0:5[0x28]: Subtitle: dvd_subtitle
    Stream #0:6[0x29]: Subtitle: dvd_subtitle
    Stream #0:7[0x23]: Subtitle: dvd_subtitle
    Stream #0:8[0x24]: Subtitle: dvd_subtitle
    Stream #0:9[0x26]: Subtitle: dvd_subtitle
    Stream #0:10[0x27]: Subtitle: dvd_subtitle

    From the above streams I'm interested in keeping two audio streams : number 1 and 4.
    As you can see the number 4 is already 96kbps so I tried to execute a command which could treat the two streams in a different way :

    cat VTS_01_1.VOB | nice ffmpeg -i - -s 640x368 -vcodec libtheora -r 25 -b:v 1200k -an -metadata title="My Title" -pass 1 -passlogfile "/media/data/outputlog" -f ogg -y /dev/null

    cat VTS_01_1.VOB | nice ffmpeg -i - -map 0:0 -s 640x368 -vcodec libtheora -r 25 -b:v 1200k -async 1 -metadata title="My Title" -map 0:1 -acodec libvorbis -ac 6 -ar 48000 -b:a 192k -metadata title="english" -map 0:4 -acodec libvorbis -ac 2 -ar 48000 -b:a 96k -metadata title="commented" -pass 2 -passlogfile "/media/data/outputlog" "/media/data/output.ogv"

    What I would like to obtain is :

    Input #0, ogg, from &#39;output.ogv&#39;:
    Duration: 00:38:07.20, start: 0.000000, bitrate: 1360 kb/s
    Stream #0:0: Video: theora, yuv420p, 640x368 [SAR 46:45 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: vorbis, 48000 Hz, stereo, s16, 192 kb/s
    Stream #0:2: Audio: vorbis, 48000 Hz, stereo, s16, 96 kb/s

    Instead with the above command I obtain :

    Input #0, ogg, from &#39;output.ogv&#39;:
    Duration: 00:38:07.20, start: 0.000000, bitrate: 1360 kb/s
    Stream #0:0: Video: theora, yuv420p, 640x368 [SAR 46:45 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: vorbis, 48000 Hz, stereo, s16, 96 kb/s
    Stream #0:2: Audio: vorbis, 48000 Hz, stereo, s16, 96 kb/s

    So how can I specify different params for multiple audio streams ?

    BTW : I'm on lubuntu oneiric with the latest ffmpeg from git

    ffmpeg version git-2012-03-05-1007a80 Copyright (c) 2000-2012 the FFmpeg developers
    built on Mar  5 2012 09:40:09 with gcc 4.6.1
    configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab --enable-libxvid --enable-libvpx
    libavutil      51. 41.100 / 51. 41.100
    libavcodec     54.  8.100 / 54.  8.100
    libavformat    54.  2.100 / 54.  2.100
    libavdevice    53.  4.100 / 53.  4.100
    libavfilter     2. 63.100 /  2. 63.100
    libswscale      2.  1.100 /  2.  1.100
    libswresample   0.  7.100 /  0.  7.100
    libpostproc    52.  0.100 / 52.  0.100

    Therefore the newaudio option is no more recognized