Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (43)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (10395)

  • How to stream live-video display from a webcam using FFMPEG command on tcl version 8.0 and windows 7 ?

    27 juin 2019, par M. D. P

    I am working on project were i need to have the live video streaming.
    I am able to save the video using the command :

    proc a {}  {
    exec ffmpeg -f dshow -rtbufsize 64M -i "video=Integrated Webcam" -s 1280x720 -f sdl2 -
    }
    a

    this is the current error:
    ffmpeg started on 2017-11-17 at 15:24:45
    Report written to "ffmpeg-20171117-152445.log"
    Command line:
    ffmpeg -f dshow -report -rtbufsize 64M -i "video=Integrated Webcam" -s 1280x720 -f sdl2 -
    ffmpeg version N-87353-g183fd30 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 7.2.0 (GCC)
     configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib
     libavutil      55. 76.100 / 55. 76.100
     libavcodec     57.106.101 / 57.106.101
     libavformat    57. 82.101 / 57. 82.101
     libavdevice    57.  8.101 / 57.  8.101
     libavfilter     6.105.100 /  6.105.100
     libswscale      4.  7.103 /  4.  7.103
     libswresample   2.  8.100 /  2.  8.100
     libpostproc    54.  6.100 / 54.  6.100
    Splitting the commandline.
    Reading option '-f' ... matched as option 'f' (force format) with argument 'dshow'.
    Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
    Reading option '-rtbufsize' ... matched as AVOption 'rtbufsize' with argument '64M'.
    Reading option '-i' ... matched as input url with argument 'video=Integrated Webcam'.
    Reading option '-s' ... matched as option 's' (set frame size (WxH or abbreviation)) with argument '1280x720'.
    Reading option '-f' ... matched as option 'f' (force format) with argument 'sdl2'.
    Reading option '-' ... matched as output url.
    Finished splitting the commandline.
    Parsing a group of options: global .
    Applying option report (generate a report) with argument 1.
    Successfully parsed a group of options.
    Parsing a group of options: input url video=Integrated Webcam.
    Applying option f (force format) with argument dshow.
    Successfully parsed a group of options.
    Opening an input file: video=Integrated Webcam.
    [dshow @ 0000000000e06a40] Selecting pin Capture on video
    dshow passing through packet of type video size   614400 timestamp 5773900280000 orig timestamp 5773900274254 graph timestamp 5773900280000 diff 5746 Integrated Webcam
    [dshow @ 0000000000e06a40] All info found
    Input #0, dshow, from 'video=Integrated Webcam':
     Duration: N/A, start: 577390.028000, bitrate: N/A
       Stream #0:0, 1, 1/10000000: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
    Successfully opened the file.
    Parsing a group of options: output url -.
    Applying option s (set frame size (WxH or abbreviation)) with argument 1280x720.
    Applying option f (force format) with argument sdl2.
    Successfully parsed a group of options.
    Opening an output file: -.
    Successfully opened the file.
    Stream mapping:
     Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
    Press [q] to stop, [?] for help
    cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    [rawvideo @ 0000000000d90be0] PACKET SIZE: 614400, STRIDE: 1280
    detected 4 logical cores
    dshow passing through packet of type video size   614400 timestamp 5773900600000 orig timestamp 5773900607587 graph timestamp 5773900600000 diff -7587 Integrated Webcam
    [graph 0 input from stream 0:0 @ 0000000000d96200] Setting 'video_size' to value '640x480'
    [graph 0 input from stream 0:0 @ 0000000000d96200] Setting 'pix_fmt' to value '1'
    [graph 0 input from stream 0:0 @ 0000000000d96200] Setting 'time_base' to value '1/10000000'
    [graph 0 input from stream 0:0 @ 0000000000d96200] Setting 'pixel_aspect' to value '0/1'
    [graph 0 input from stream 0:0 @ 0000000000d96200] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 0:0 @ 0000000000d96200] Setting 'frame_rate' to value '10000000/333333'
    [graph 0 input from stream 0:0 @ 0000000000d96200] w:640 h:480 pixfmt:yuyv422 tb:1/10000000 fr:10000000/333333 sar:0/1 sws_param:flags=2
    [scaler_out_0_0 @ 0000000000d967e0] Setting 'w' to value '1280'
    [scaler_out_0_0 @ 0000000000d967e0] Setting 'h' to value '720'
    [scaler_out_0_0 @ 0000000000d967e0] Setting 'flags' to value 'bicubic'
    [scaler_out_0_0 @ 0000000000d967e0] w:1280 h:720 flags:'bicubic' interl:0
    [AVFilterGraph @ 0000000000d94d40] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
    [scaler_out_0_0 @ 0000000000d967e0] w:640 h:480 fmt:yuyv422 sar:0/1 -> w:1280 h:720 fmt:yuyv422 sar:0/1 flags:0x4
    dshow passing through packet of type video size   614400 timestamp 5773900970000 orig timestamp 5773900940920 graph timestamp 5773900970000 diff 29080 Integrated Webcam
    dshow passing through packet of type video size   614400 timestamp 5773901240000 orig timestamp 5773901274253 graph timestamp 5773901240000 diff -34253 Integrated Webcam
    dshow passing through packet of type video size   614400 timestamp 5773901720000 orig timestamp 5773901607586 graph timestamp 5773901720000 diff 112414 Integrated Webcam
    dshow passing through packet of type video size   614400 timestamp 5773902040000 orig timestamp 5773901940919 graph timestamp 5773902040000 diff 99081 Integrated Webcam
    dshow passing through packet of type video size   614400 timestamp 5773902360000 orig timestamp 5773902274252 graph timestamp 5773902360000 diff 85748 Integrated Webcam
    dshow passing through packet of type video size   614400 timestamp 5773902680000 orig timestamp 5773902607585 graph timestamp 5773902680000 diff 72415 Integrated Webcam
    dshow passing through packet of type video size   614400 timestamp 5773903000000 orig timestamp 5773902940918 graph timestamp 5773903000000 diff 59082 Integrated Webcam
    dshow passing through packet of type video size   614400 timestamp 5773903320000 orig timestamp 5773903274251 graph timestamp 5773903320000 diff 45749 Integrated Webcam
    dshow passing through packet of type video size   614400 timestamp 5773903640000 orig timestamp 5773903607584 graph timestamp 5773903640000 diff 32416 Integrated Webcam
    [sdl,sdl2 @ 0000000000d911c0] w:1280 h:720 fmt:yuyv422 -> w:1280 h:720
    Output #0, sdl,sdl2, to 'pipe:':
     Metadata:
       encoder         : Lavf57.82.101
       Stream #0:0, 0, 333333/10000000: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, q=2-31, 442368 kb/s, 30 fps, 30 tbn, 30 tbc
       Metadata:
         encoder         : Lavc57.106.101 rawvideo
    dshow passing through packet of type video size   614400 timestamp 5773903970000 orig timestamp 5773903940917 graph timestamp 5773903970000 diff 29083 Integrated Webcam
    dshow passing through packet of type video size   614400 timestamp 5773904280000 orig timestamp 5773904274250 graph timestamp 5773904280000 diff 5750 Integrated Webcam
    av_interleaved_write_frame(): Operation not permitted
    No more output streams to write to, finishing.
    dshow passing through packet of type video size   614400 timestamp 5773904660000 orig timestamp 5773904607583 graph timestamp 5773904660000 diff 52417 Integrated Webcam
    frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=0.0797x    
    video:1800kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    Input file #0 (video=Integrated Webcam):
     Input stream #0:0 (video): 1 packets read (614400 bytes); 1 frames decoded;
     Total: 1 packets (614400 bytes) demuxed
    Output file #0 (pipe:):
     Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (1843200 bytes);
     Total: 1 packets (1843200 bytes) muxed
    1 frames successfully decoded, 0 decoding errors
    dshow passing through packet of type video size        0 timestamp 5773907070000 orig timestamp 2644601806342528 graph timestamp 5773907070000 diff -2638827899272528 Integrated Webcam
    Conversion failed!
    % source c:/other/a/d.tcl
    couldn't execute "ffmpeg -f dshow -t 00:00:10 -i {video=Integrated Webcam} -b 5000k -s 1280x720 c:\test\sample-a.avi": no such file or directory
    % source c:/other/a/d.tcl
    invalid command name "ffmpeg"
    % source c:/other/a/d.tcl
    ffmpeg version N-87353-g183fd30 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 7.2.0 (GCC)
     configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib
     libavutil      55. 76.100 / 55. 76.100
     libavcodec     57.106.101 / 57.106.101
     libavformat    57. 82.101 / 57. 82.101
     libavdevice    57.  8.101 / 57.  8.101
     libavfilter     6.105.100 /  6.105.100
     libswscale      4.  7.103 /  4.  7.103
     libswresample   2.  8.100 /  2.  8.100
     libpostproc    54.  6.100 / 54.  6.100
    Input #0, dshow, from 'video=Integrated Webcam':
     Duration: N/A, start: 523220.045000, bitrate: N/A
       Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
    Press [q] to stop, [?] for help
    Output #0, sdl,sdl2, to 'pipe:':
     Metadata:
       encoder         : Lavf57.82.101
       Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, q=2-31, 442368 kb/s, 30 fps, 30 tbn, 30 tbc
       Metadata:
         encoder         : Lavc57.106.101 rawvideo
    av_interleaved_write_frame(): Operation not permitted
    frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=0.0471x
    video:1800kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    Conversion failed!
    %

    But, the problem is i don’t want to save the video, I just want to have live video streaming.

    link : https://trac.ffmpeg.org/wiki/StreamingGuide, provide the command for live video streaming, but it want work, the webcem gets started, but live video streaming is not displayed on screen.

    so, can any one help me out to get right "FFMPEG" command or even any TCL script, to get the live video streaming displayed on on my windows 7.

    ffplay started on 2017-11-17 at 12:44:40
    Report written to "ffplay-20171117-124440.log"
    Command line:
    ffplay -report C:/test/sample.avi
    ffplay version N-87353-g183fd30 Copyright (c) 2003-2017 the FFmpeg developers
     built with gcc 7.2.0 (GCC)
     configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib
     libavutil      55. 76.100 / 55. 76.100
     libavcodec     57.106.101 / 57.106.101
     libavformat    57. 82.101 / 57. 82.101
     libavdevice    57.  8.101 / 57.  8.101
     libavfilter     6.105.100 /  6.105.100
     libswscale      4.  7.103 /  4.  7.103
     libswresample   2.  8.100 /  2.  8.100
     libpostproc    54.  6.100 / 54.  6.100
       nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0  
    [NULL @ 0000000002aea040] Opening 'C:/test/sample.avi' for reading
    [file @ 0000000002ae9c80] Setting default whitelist 'file,crypto'
    [avi @ 0000000002aea040] Format avi probed with size=2048 and score=100
    [avi @ 0000000002af30c0] use odml:1
    [avi @ 0000000002aea040] Before avformat_find_stream_info() pos: 5678 bytes read:107912 seeks:4 nb_streams:1
    [avi @ 0000000002aea040] All info found
    [avi @ 0000000002aea040] After avformat_find_stream_info() pos: 33035 bytes read:107912 seeks:4 frames:1
    Input #0, avi, from 'C:/test/sample.avi':
     Metadata:
       encoder         : Lavf57.82.101
     Duration: 00:00:10.00, start: 0.000000, bitrate: 5072 kb/s
       Stream #0:0, 1, 1/30: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 5078 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
    detected 4 logical cores
       nan M-V:    nan fd=   0 aq=    0KB vq=  595KB sq=    0B f=0/0  
    Video frame changed from size:0x0 format:none serial:-1 to size:1280x720 format:yuv420p serial:1
    [ffplay_buffer @ 0000000003a17ee0] Setting 'video_size' to value '1280x720'
    [ffplay_buffer @ 0000000003a17ee0] Setting 'pix_fmt' to value '0'
    [ffplay_buffer @ 0000000003a17ee0] Setting 'time_base' to value '1/30'
    [ffplay_buffer @ 0000000003a17ee0] Setting 'pixel_aspect' to value '1/1'
    [ffplay_buffer @ 0000000003a17ee0] Setting 'frame_rate' to value '30/1'
    [ffplay_buffer @ 0000000003a17ee0] w:1280 h:720 pixfmt:yuv420p tb:1/30 fr:30/1 sar:1/1 sws_param:
    [AVFilterGraph @ 0000000002b14fc0] query_formats: 2 queried, 1 merged, 0 already done, 0 delayed
  • Spotlight : Alwaysdata.com the company behind Piwik.org web hosting [Interview]

    11 avril 2013, par matt — About, Community

    Piwik is the result of the work of many talented individuals and companies. Today we’d like to showcase Alwaysdata.com, the awesome web hosting company providing managed hosting for all Piwik.org websites and services.

    I recently met and asked a few questions to Cyril, co-founder of Alwaysdata.com and Piwik core developer. Learn more in the interview below !

    What is Alwaysdata ?

    We are a French web hosting company created in 2006. If you need to host a website — a Piwik installation, for example — or even your domains/emails, we provide infrastructure and maintenance services.

    Who are your customers and what kind of work do you do ?

    We have several types of clients :

    • Individuals who need hosting for their personal site and who benefit from storage space with direct SSH access.
    • Web agencies who need hosting for their clients’ sites.
    • The largest customers, often on dedicated servers, for hosting their site/infrastructure.

    Our work falls into three categories :

    1. Support (via administration, telephone, Twitter, IRC, etc.)
    2. Development (in Python), primarily to add new features
    3. System administration, either for maintenance (e.g. adding servers), or for preparing new features

    What sets Alwaysdata apart from the large web hosting competition ?

    Two things :

    • Availability. We are a small team and often know our customers quite well. We are all on IRC, so you can contact us directly if you need any assistance.
    • Features. We are halfway between traditional web hosting and the cloud, combining the advantages of both.

    Are you using Piwik internally or with customers ? If so, how are you using Piwik ?

    All of our customers can view statistics for their sites via our global Piwik installation, without having to configure anything.

    To provide these analytics reports to our customers, we implemented import of the raw access logs in Piwik. The Log import toolkit is now a feature included in Piwik.

    What is the next big thing for Alwaysdata ?

    We are going to upgrade our pricing : instead of fixed costs, each of our clients will now pay exactly what they consume. This allows our clients the benefit of a very high quality service for the lowest possible price.

    We are also going to add native support for more technologies : Java, Node.js, ZeroMQ, etc.

    Thank you for your time and all the best to Alwaysdata for the future !

    Note from Matt, Piwik founder : Cyril and the team at Alwaysdata.com have been consistently great in their system administration work for Piwik.org services, providing a fast and reliable web hosting experience with top notch support and security practises. They also handled the migration of all services from our old servers with total piece of mind.

    Alwaysdata contributed to Piwik the popular Log Analytics toolkit. They are great software developers and system administrators with a passion for their work. Since 2006, they have been maintaining optimized hosting services for the entire web infrastructure (websites, domains, emails, databases, etc.), from the simplest to the most exotic. We do recommend their managed hosting services.

    Learn more

  • FFMPEG not working from Python subprocess.Popen but works from command line

    21 novembre 2017, par Stuart Clarke

    I’m trying to run a FFMPEG script from within python 3.5.2. the FFMPEG command runs fine from the command line but fails within the python script.

    The function I use to execute the FFMPEG command is

    def ffmpeg(args):
       err = None
       command = [
           ffmpegcmd, '-y',
           '-loglevel', loglevel
       ] + args
       print("\n\n\n")
       print(command)
       print("\n\n\n")
       print(" ".join(command))
       ffmpeg = subprocess.Popen(command, stderr=subprocess.PIPE ,stdout=subprocess.PIPE, universal_newlines=True)
       while err == None:
           out, err = ffmpeg.communicate()
           time.sleep(1)
       if err and loglevel=='fatal':
           print(" ".join(command))
           raise Exception(err)
       print(err)

    The value for args is :

    ['-i', '/var/www/temp/film.mp4', '-vf', 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black', '/var/www/temp/videoHD.mp4']

    such that the resultant command being passed to subprocess.Popen is :

    ['ffmpeg', '-y', '-loglevel', 'verbose', '-i', '/var/www/temp/film.mp4', '-vf', 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black', '/var/www/temp/videoHD.mp4']

    The value of loglevel is verbose only for troubleshooting but is intended to run as fatal. There are also some print commands only in place for troubleshooting.

    The reason for wanting to increase the resolution is so that it can be combined later with higher resolution videos.

    The result when running from within python is :

    ffmpeg version 3.3.4-2~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
     configuration: --prefix=/usr --extra-version='2~16.04.york0' --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 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --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. 58.100 / 55. 58.100
     libavcodec     57. 89.100 / 57. 89.100
     libavformat    57. 71.100 / 57. 71.100
     libavdevice    57.  6.100 / 57.  6.100
     libavfilter     6. 82.100 /  6. 82.100
     libavresample   3.  5.  0 /  3.  5.  0
     libswscale      4.  6.100 /  4.  6.100
     libswresample   2.  7.100 /  2.  7.100
     libpostproc    54.  5.100 / 54.  5.100
    [h264 @ 0x7f741a37a560] Reinit context to 640x368, pix_fmt: yuv420p
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/temp/film.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
     Duration: 00:06:19.80, start: 0.000000, bitrate: 451 kb/s
       Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x358 (640x368), 313 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    [h264 @ 0x7f741a3bc700] Reinit context to 640x368, pix_fmt: yuv420p
    [graph_1_in_0_1 @ 0x7f741a5315e0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
    [Parsed_scale_0 @ 0x7f741a54e000] w:1920 h:1080 flags:'bicubic' interl:0
    [graph 0 input from stream 0:0 @ 0x7f741a54f6a0] w:640 h:358 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:0/1 sws_param:flags=2
    [Parsed_scale_0 @ 0x7f741a54e000] w:640 h:358 fmt:yuv420p sar:0/1 -> w:1920 h:1074 fmt:yuv420p sar:0/1 flags:0x4
    [Parsed_pad_1 @ 0x7f741a54eac0] w:1920 h:1074 -> w:1920 h:1080 x:0 y:2 color:0x000000FF
    [libx264 @ 0x7f741a5509e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x7f741a5509e0] profile High, level 4.0
    [libx264 @ 0x7f741a5509e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 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=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 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 '/var/www/temp/videoHD.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
       Stream #0:0(und): Video: h264 (libx264), 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc57.89.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         encoder         : Lavc57.89.100 aac

    This results in a file with no content.

    When I run the command from the command line I need to add single quotes around the -vf video filters scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black so the whole command becomes :

    ffmpeg -y -loglevel verbose -i /var/www/temp/film.mp4 -vf 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black' /var/www/temp/videoHD.mp4

    Running this command gives the required result.

    ffmpeg version 3.3.4-2~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
     configuration: --prefix=/usr --extra-version='2~16.04.york0' --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 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --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. 58.100 / 55. 58.100
     libavcodec     57. 89.100 / 57. 89.100
     libavformat    57. 71.100 / 57. 71.100
     libavdevice    57.  6.100 / 57.  6.100
     libavfilter     6. 82.100 /  6. 82.100
     libavresample   3.  5.  0 /  3.  5.  0
     libswscale      4.  6.100 /  4.  6.100
     libswresample   2.  7.100 /  2.  7.100
     libpostproc    54.  5.100 / 54.  5.100
    [h264 @ 0x7f3a55c17560] Reinit context to 640x368, pix_fmt: yuv420p
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/temp/film.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
     Duration: 00:06:19.80, start: 0.000000, bitrate: 451 kb/s
       Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x358 (640x368), 313 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    [h264 @ 0x7f3a55c59700] Reinit context to 640x368, pix_fmt: yuv420p
    [graph_1_in_0_1 @ 0x7f3a55dce5e0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
    [Parsed_scale_0 @ 0x7f3a55deb000] w:1920 h:1080 flags:'bicubic' interl:0
    [graph 0 input from stream 0:0 @ 0x7f3a55dec6a0] w:640 h:358 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:0/1 sws_param:flags=2
    [Parsed_scale_0 @ 0x7f3a55deb000] w:640 h:358 fmt:yuv420p sar:0/1 -> w:1920 h:1074 fmt:yuv420p sar:0/1 flags:0x4
    [Parsed_pad_1 @ 0x7f3a55debac0] w:1920 h:1074 -> w:1920 h:1080 x:0 y:2 color:0x000000FF
    [libx264 @ 0x7f3a55ded9e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x7f3a55ded9e0] profile High, level 4.0
    [libx264 @ 0x7f3a55ded9e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 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=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 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 '/var/www/temp/videoHD.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
       Stream #0:0(und): Video: h264 (libx264), 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc57.89.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         encoder         : Lavc57.89.100 aac
    frame=   46 fps=0.0 q=0.0 size=       0kB time=00:00:01.62 bitrate=   0.0kbits/s
    frame=   59 fps= 47 q=29.0 size=     116kB time=00:00:02.04 bitrate= 464.8kbits/
    frame=   74 fps= 41 q=29.0 size=     223kB time=00:00:02.56 bitrate= 714.8kbits/
    frame=   87 fps= 35 q=29.0 size=     344kB time=00:00:02.98 bitrate= 942.4kbits/
    frame=   98 fps= 33 q=29.0 size=     427kB time=00:00:03.34 bitrate=1043.4kbits/
       blah
       blah
       blah
    frame=11347 fps= 21 q=29.0 size=   97550kB time=00:06:18.32 bitrate=2112.3kbits/
    frame=11363 fps= 21 q=29.0 size=   97713kB time=00:06:18.85 bitrate=2112.8kbits/
    frame=11380 fps= 21 q=29.0 size=   97795kB time=00:06:19.41 bitrate=2111.5kbits/
    No more output streams to write to, finishing.
    frame=11392 fps= 21 q=-1.0 Lsize=   98519kB time=00:06:19.77 bitrate=2125.1kbits/s speed=0.69x    
    video:92124kB audio:5986kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.416313%
    Input file #0 (/var/www/temp/film.mp4):
     Input stream #0:0 (video): 11392 packets read (14892948 bytes); 11392 frames decoded;
     Input stream #0:1 (audio): 17803 packets read (6112540 bytes); 17802 frames decoded (18229248 samples);
     Total: 29195 packets (21005488 bytes) demuxed
    Output file #0 (/var/www/temp/videoHD.mp4):
     Output stream #0:0 (video): 11392 frames encoded; 11392 packets muxed (94334785 bytes);
     Output stream #0:1 (audio): 17802 frames encoded (18229248 samples); 17803 packets muxed (6129981 bytes);
     Total: 29195 packets (100464766 bytes) muxed
    [libx264 @ 0x7f3a55ded9e0] frame I:74    Avg QP:19.08  size: 51540
    [libx264 @ 0x7f3a55ded9e0] frame P:3506  Avg QP:21.34  size: 19348
    [libx264 @ 0x7f3a55ded9e0] frame B:7812  Avg QP:24.07  size:  2904
    [libx264 @ 0x7f3a55ded9e0] consecutive B-frames:  1.3% 20.2%  4.6% 73.9%
    [libx264 @ 0x7f3a55ded9e0] mb I  I16..4: 19.7% 73.6%  6.7%
    [libx264 @ 0x7f3a55ded9e0] mb P  I16..4:  3.2%  6.4%  0.1%  P16..4: 52.5%  7.6%  2.6%  0.0%  0.0%    skip:27.6%
    [libx264 @ 0x7f3a55ded9e0] mb B  I16..4:  0.2%  0.2%  0.0%  B16..8: 23.2%  0.4%  0.0%  direct: 0.5%  skip:75.5%  L0:51.8% L1:46.6% BI: 1.6%
    [libx264 @ 0x7f3a55ded9e0] 8x8 transform intra:66.4% inter:94.0%
    [libx264 @ 0x7f3a55ded9e0] coded y,uvDC,uvAC intra: 33.6% 53.4% 7.3% inter: 5.3% 14.2% 0.0%
    [libx264 @ 0x7f3a55ded9e0] i16 v,h,dc,p: 22% 27%  5% 46%
    [libx264 @ 0x7f3a55ded9e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 19% 20%  4%  7%  7%  7%  5%  4%
    [libx264 @ 0x7f3a55ded9e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 28% 11%  3%  9%  7%  6%  3%  2%
    [libx264 @ 0x7f3a55ded9e0] i8c dc,h,v,p: 49% 21% 20% 10%
    [libx264 @ 0x7f3a55ded9e0] Weighted P-Frames: Y:0.5% UV:0.1%
    [libx264 @ 0x7f3a55ded9e0] ref P L0: 63.4%  8.9% 21.4%  6.3%  0.0%
    [libx264 @ 0x7f3a55ded9e0] ref B L0: 89.3%  9.1%  1.6%
    [libx264 @ 0x7f3a55ded9e0] ref B L1: 98.1%  1.9%
    [libx264 @ 0x7f3a55ded9e0] kb/s:1987.38
    [aac @ 0x7f3a55deee80] Qavg: 1160.814

    and the resulting video is fine.

    Any ideas ?

    Cheers,

    Stu

    Edit

    It was suggested that I use a new function to do much the same thing. So I added the following function and used it for the command that I’m having trouble with :

    def ffmpegPro(args):
       err = None
       for i, arg in enumerate(args):
           if(" " in arg or "(" in arg or "[" in arg):
               args[i] = "\"" + arg + "\""
       command = [
           ffmpegcmd, '-y',
           '-loglevel', loglevel
       ] + args
       commandStr = " ".join(command)
       print("\n\n\n")
       print(command)
       print("\n\n\n")
       print(commandStr)
       ffmpeg = subprocess.Popen(commandStr, stderr=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True, shell=True)
       while err == None:
           out, err = ffmpeg.communicate()
           time.sleep(1)
       if ffmpeg.returncode == 0 and all([os.path.exists(f) for f in (videoStorage['data_small'], videoStorage['data_big'])]):
           print("Job done.")
       else:
           print("ERROR")
           print(err)

    The resulting command can now be used in python or at the command line without needing to be changed at all. The command is :

    ffmpeg -y -loglevel verbose -i /var/www/temp/film.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black" /var/www/temp/videoHD.mp4

    The result when executed in python is

    ffmpeg version 3.3.4-2~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
     configuration: --prefix=/usr --extra-version='2~16.04.york0' --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 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --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. 58.100 / 55. 58.100
     libavcodec     57. 89.100 / 57. 89.100
     libavformat    57. 71.100 / 57. 71.100
     libavdevice    57.  6.100 / 57.  6.100
     libavfilter     6. 82.100 /  6. 82.100
     libavresample   3.  5.  0 /  3.  5.  0
     libswscale      4.  6.100 /  4.  6.100
     libswresample   2.  7.100 /  2.  7.100
     libpostproc    54.  5.100 / 54.  5.100
    [h264 @ 0x7fb75053d560] Reinit context to 640x368, pix_fmt: yuv420p
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/temp/film.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
     Duration: 00:06:19.80, start: 0.000000, bitrate: 451 kb/s
       Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x358 (640x368), 313 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    [h264 @ 0x7fb75057f700] Reinit context to 640x368, pix_fmt: yuv420p
    [graph_1_in_0_1 @ 0x7fb7506f45e0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
    [Parsed_scale_0 @ 0x7fb750711000] w:1920 h:1080 flags:'bicubic' interl:0
    [graph 0 input from stream 0:0 @ 0x7fb7507126a0] w:640 h:358 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:0/1 sws_param:flags=2
    [Parsed_scale_0 @ 0x7fb750711000] w:640 h:358 fmt:yuv420p sar:0/1 -> w:1920 h:1074 fmt:yuv420p sar:0/1 flags:0x4
    [Parsed_pad_1 @ 0x7fb750711ac0] w:1920 h:1074 -> w:1920 h:1080 x:0 y:2 color:0x000000FF
    [libx264 @ 0x7fb7507139e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x7fb7507139e0] profile High, level 4.0
    [libx264 @ 0x7fb7507139e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 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=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 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 '/var/www/temp/videoHD.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
       Stream #0:0(und): Video: h264 (libx264), 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc57.89.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         encoder         : Lavc57.89.100 aac
    Killed

    Note the Killed at the end. Is this significant and why is it only happening when executed in the script ?

    Here is the output from the command line which results in a successful video file.

    ffmpeg version 3.3.4-2~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
     configuration: --prefix=/usr --extra-version='2~16.04.york0' --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 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --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. 58.100 / 55. 58.100
     libavcodec     57. 89.100 / 57. 89.100
     libavformat    57. 71.100 / 57. 71.100
     libavdevice    57.  6.100 / 57.  6.100
     libavfilter     6. 82.100 /  6. 82.100
     libavresample   3.  5.  0 /  3.  5.  0
     libswscale      4.  6.100 /  4.  6.100
     libswresample   2.  7.100 /  2.  7.100
     libpostproc    54.  5.100 / 54.  5.100
    [h264 @ 0x7fb52cfb3560] Reinit context to 640x368, pix_fmt: yuv420p
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/temp/film.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
     Duration: 00:06:19.80, start: 0.000000, bitrate: 451 kb/s
       Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x358 (640x368), 313 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    [h264 @ 0x7fb52cff5700] Reinit context to 640x368, pix_fmt: yuv420p
    [graph_1_in_0_1 @ 0x7fb52d16a5e0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
    [Parsed_scale_0 @ 0x7fb52d187000] w:1920 h:1080 flags:'bicubic' interl:0
    [graph 0 input from stream 0:0 @ 0x7fb52d1886a0] w:640 h:358 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:0/1 sws_param:flags=2
    [Parsed_scale_0 @ 0x7fb52d187000] w:640 h:358 fmt:yuv420p sar:0/1 -> w:1920 h:1074 fmt:yuv420p sar:0/1 flags:0x4
    [Parsed_pad_1 @ 0x7fb52d187ac0] w:1920 h:1074 -> w:1920 h:1080 x:0 y:2 color:0x000000FF
    [libx264 @ 0x7fb52d1899e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x7fb52d1899e0] profile High, level 4.0
    [libx264 @ 0x7fb52d1899e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 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=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 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 '/var/www/temp/videoHD.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
       Stream #0:0(und): Video: h264 (libx264), 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc57.89.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         encoder         : Lavc57.89.100 aac
    frame=   47 fps=0.0 q=0.0 size=       0kB time=00:00:01.66 bitrate=   0.0kbits/s
    frame=   59 fps= 41 q=29.0 size=     116kB time=00:00:02.04 bitrate= 464.8kbits/
    frame=   71 fps= 35 q=29.0 size=     201kB time=00:00:02.45 bitrate= 671.3kbits/
    frame=   80 fps= 31 q=29.0 size=     276kB time=00:00:02.75 bitrate= 822.0kbits/
       Blah
       Blah
       Blah
    frame=11337 fps= 21 q=29.0 size=   97503kB time=00:06:17.98 bitrate=2113.2kbits/
    frame=11351 fps= 21 q=26.0 size=   97572kB time=00:06:18.45 bitrate=2112.1kbits/
    frame=11371 fps= 21 q=29.0 size=   97745kB time=00:06:19.11 bitrate=2112.1kbits/
    frame=11390 fps= 21 q=29.0 size=   97852kB time=00:06:19.73 bitrate=2111.0kbits/
    No more output streams to write to, finishing.
    frame=11392 fps= 21 q=-1.0 Lsize=   98519kB time=00:06:19.77 bitrate=2125.1kbits/s speed=0.688x    
    video:92124kB audio:5986kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.416313%
    Input file #0 (/var/www/temp/film.mp4):
     Input stream #0:0 (video): 11392 packets read (14892948 bytes); 11392 frames decoded;
     Input stream #0:1 (audio): 17803 packets read (6112540 bytes); 17802 frames decoded (18229248 samples);
     Total: 29195 packets (21005488 bytes) demuxed
    Output file #0 (/var/www/temp/videoHD.mp4):
     Output stream #0:0 (video): 11392 frames encoded; 11392 packets muxed (94334785 bytes);
     Output stream #0:1 (audio): 17802 frames encoded (18229248 samples); 17803 packets muxed (6129981 bytes);
     Total: 29195 packets (100464766 bytes) muxed
    [libx264 @ 0x7fb52d1899e0] frame I:74    Avg QP:19.08  size: 51540
    [libx264 @ 0x7fb52d1899e0] frame P:3506  Avg QP:21.34  size: 19348
    [libx264 @ 0x7fb52d1899e0] frame B:7812  Avg QP:24.07  size:  2904
    [libx264 @ 0x7fb52d1899e0] consecutive B-frames:  1.3% 20.2%  4.6% 73.9%
    [libx264 @ 0x7fb52d1899e0] mb I  I16..4: 19.7% 73.6%  6.7%
    [libx264 @ 0x7fb52d1899e0] mb P  I16..4:  3.2%  6.4%  0.1%  P16..4: 52.5%  7.6%  2.6%  0.0%  0.0%    skip:27.6%
    [libx264 @ 0x7fb52d1899e0] mb B  I16..4:  0.2%  0.2%  0.0%  B16..8: 23.2%  0.4%  0.0%  direct: 0.5%  skip:75.5%  L0:51.8% L1:46.6% BI: 1.6%
    [libx264 @ 0x7fb52d1899e0] 8x8 transform intra:66.4% inter:94.0%
    [libx264 @ 0x7fb52d1899e0] coded y,uvDC,uvAC intra: 33.6% 53.4% 7.3% inter: 5.3% 14.2% 0.0%
    [libx264 @ 0x7fb52d1899e0] i16 v,h,dc,p: 22% 27%  5% 46%
    [libx264 @ 0x7fb52d1899e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 19% 20%  4%  7%  7%  7%  5%  4%
    [libx264 @ 0x7fb52d1899e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 28% 11%  3%  9%  7%  6%  3%  2%
    [libx264 @ 0x7fb52d1899e0] i8c dc,h,v,p: 49% 21% 20% 10%
    [libx264 @ 0x7fb52d1899e0] Weighted P-Frames: Y:0.5% UV:0.1%
    [libx264 @ 0x7fb52d1899e0] ref P L0: 63.4%  8.9% 21.4%  6.3%  0.0%
    [libx264 @ 0x7fb52d1899e0] ref B L0: 89.3%  9.1%  1.6%
    [libx264 @ 0x7fb52d1899e0] ref B L1: 98.1%  1.9%
    [libx264 @ 0x7fb52d1899e0] kb/s:1987.38
    [aac @ 0x7fb52d18ae80] Qavg: 1160.814

    Any more ideas why this is being handled differently in python as opposed to the command line ?

    I’m believe this is a version issue and that is why the below answer did not work for me, things were fine before I upgraded but since then a lot of things have been playing up. I upgraded both ffmpeg and python versions and don’t really want to go back if it can be avoided.

    Thanks,

    Stu