Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61155

Re: using ffmpeg command line with python's subprocess module

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:command': 0.09; 'subject:module': 0.09; 'subject:using': 0.09; 'cc:addr:python- list': 0.11; 'attribute,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'job!': 0.16; 'written.': 0.16; 'subject:python': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'all,': 0.19; "skip:' 30": 0.19; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'points': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'getting': 0.31; 'file': 0.32; 'open': 0.33; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'skip:f 40': 0.36; 'even': 0.60; 'skip:n 10': 0.64; 'close': 0.67; 'to:none': 0.92; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=XMDM2uVVTi/xp0v86Uqoh1P37o3cC1NpKsIskSOiVzU=; b=s8JXU2xYFuptXvYdOA7d6UnjLG9y4C7aCs3jO6rPtqtp5rGgOvaeqBfmu5qIGZKpzU NWFvOU1BnhQ4yanvJjLPmGDURW/DepbbVnB0T1l7g9ymTHNZhX8aGX3yZ+AdYFIjKEfG ufB14vIHm+PrCC6HKHVotUr7D4kUd+c1s+3y0jsqrxI+X3tSHRsWBE0a94FCHJbbqA52 6WUboZYyFBrMRFvpJkAIa2TTnlUS9ZJAwFwXv28mM2CrVjQK7130GC3nhbffGXRCXcBC Bnx7BRwjk6YhHuIGC+A1p7sHhRhmCG5r+ysWLg4BDBx8jpb/X1mDfGGHIvSsddtZldIG 0cMA==
MIME-Version 1.0
X-Received by 10.68.236.133 with SMTP id uu5mr4673878pbc.153.1386341983441; Fri, 06 Dec 2013 06:59:43 -0800 (PST)
In-Reply-To <60f2e393-658c-4e18-85b1-fc7d0b07ddb4@googlegroups.com>
References <d344154e-1de9-4016-b1fc-d1e9d989529d@googlegroups.com> <CAPTjJmrG+ik5=kOxC5AYg2BFe2F3CzWmAREReuw9-w=TuDuPuQ@mail.gmail.com> <mailman.3478.1386019175.18130.python-list@python.org> <3104d38f-3fca-43b0-b6a4-b600684f765e@googlegroups.com> <6fb2b162-cf9b-4c1c-bf5f-f14baf5baac4@googlegroups.com> <35c86484-d0dd-4954-adee-cde3a2fd7ac1@googlegroups.com> <20131204103827.6c5332c6@Hof> <mailman.3554.1386154312.18130.python-list@python.org> <60f2e393-658c-4e18-85b1-fc7d0b07ddb4@googlegroups.com>
Date Sat, 7 Dec 2013 01:59:43 +1100
Subject Re: using ffmpeg command line with python's subprocess module
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3652.1386341991.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386341991 news.xs4all.nl 2877 [2001:888:2000:d::a6]:57977
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61155

Show key headers only | View raw


On Sat, Dec 7, 2013 at 1:54 AM, iMath <redstone-cold@163.com> wrote:
>     fp=tempfile.NamedTemporaryFile(delete=False)
>     fp.write(("file '"+fileName1+"'\n").encode('utf-8'))
>     fp.write(("file '"+fileName2+"'\n").encode('utf-8'))
>
>
>     subprocess.call(['ffmpeg', '-f', 'concat','-i',fp.name, '-c',  'copy', fileName])
>     fp.close()

You need to close the file before getting the other process to use it.
Otherwise, it may not be able to open the file at all, and even if it
can, you might find that not all the data has been written.

But congrats! You have successfully found the points I was directing
you to. Yes, I was hinting that you need NamedTemporaryFile, the .name
attribute, and delete=False. Good job!

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-02 03:34 -0800
  Re: using ffmpeg command line with python's subprocess module Chris Angelico <rosuav@gmail.com> - 2013-12-02 22:40 +1100
  Re: using ffmpeg command line with python's subprocess module Ben Finney <ben+python@benfinney.id.au> - 2013-12-03 08:19 +1100
    Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-02 17:15 -0800
      Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-02 17:42 -0800
        Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-03 17:42 -0800
        Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-03 17:42 -0800
          Re: using ffmpeg command line with python's subprocess module Andreas Perstinger <andipersti@gmail.com> - 2013-12-04 10:38 +0100
            Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-05 22:23 -0800
              Re: using ffmpeg command line with python's subprocess module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-06 09:23 +0000
                Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-06 06:52 -0800
                Re: using ffmpeg command line with python's subprocess module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-06 15:12 +0000
                Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-06 07:15 -0800
                Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-06 07:13 -0800
                Re: using ffmpeg command line with python's subprocess module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-06 15:34 +0000
                Re: using ffmpeg command line with python's subprocess module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-06 15:53 +0000
                Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-06 08:19 -0800
                Re: using ffmpeg command line with python's subprocess module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-06 16:25 +0000
                Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-06 08:45 -0800
                Re: using ffmpeg command line with python's subprocess module MRAB <python@mrabarnett.plus.com> - 2013-12-06 16:41 +0000
                Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-06 08:53 -0800
                Re: using ffmpeg command line with python's subprocess module Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-12-07 13:01 +1300
              Re: using ffmpeg command line with python's subprocess module Ned Batchelder <ned@nedbatchelder.com> - 2013-12-06 06:31 -0500
          Re: using ffmpeg command line with python's subprocess module Chris Angelico <rosuav@gmail.com> - 2013-12-04 21:51 +1100
            Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-06 06:54 -0800
              Re: using ffmpeg command line with python's subprocess module Chris Angelico <rosuav@gmail.com> - 2013-12-07 01:59 +1100
                Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-09 01:04 -0800
                Re: using ffmpeg command line with python's subprocess module Andreas Perstinger <andipersti@gmail.com> - 2013-12-10 13:59 +0100
    Re: using ffmpeg command line with python's subprocess module Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2013-12-03 10:33 +0100
      Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-03 05:59 -0800
  Re: using ffmpeg command line with python's subprocess module Chris Angelico <rosuav@gmail.com> - 2013-12-03 08:25 +1100

csiph-web