2

My laptop runs Xubuntu 14.04 LTS. I'm composing a score for a silent film, and I'm trying to "Mickey Mouse" it (synchronize notes to the action). I can tweak the silent film's editing slightly to line up events with beats of the music. The tool for making the film renders to a lossless intermediate (AVI with Huffyuv) at about 1 GB per two minutes, which I can encode to a compressed format (WebM with VP8 or MPEG-4 with AVC).

If I've already encoded the video, I normally use this command line to combine the compressed video with the score, based on avconv replace audio:

avconv -y -i the_video.mp4 -i the_audio.wav -map 0:0 -map 1:0 -c:v copy -c:a libvo_aacenc -ac 1 -ab 48000 -t 120 result.mp4
avplay result.mp4

Because the lossless intermediate is gigabytes in size, I don't want to use -c:v copy to copy those gigabytes every time I want to check my changes. Nor do I want to encode every time because my laptop's CPU (Atom N450, 1 core 2 threads) is too slow to encode full-size video in real time. But when I try to use a similar command line to play instead of encoding:

avplay -i the_video.avi -i sound/sticks.wav -map 0:0 -map 1:0

I get the following error message:

avplay version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2003-2014 the Libav developers
  built on Mar 16 2015 13:20:58 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
Argument 'sound/sticks.wav' provided as input filename, but 'hyf_enc.mp4' was already specified.

Google "avplay" "was already specified" produced only source code results, not workarounds. I tried "ffplay" "was already specified" as well, but most pages with questions about that were related to overlaying a PNG, not muxing.

How should I play one file's audio and another file's video, with seeking linked between the two, without having to remux them to a file on the disk? Would a player in Ubuntu's repositories other than avplay work well for this? Or should I just shrink the lossless intermediate in order to make remuxing practical?

Damian Yerrick
  • 197
  • 1
  • 14

1 Answers1

0

My knowledge is based on the ffmpeg and ffplay tools which I understand to be replaced by avconv and avplay on Ubuntu which are supposed to be functionally equivalent (let's not debate on how far that functional equivalence goes).

I don't think the play tools accept multiple inputs. You can stream via a pipe from ffmpeg (er, avconv) into ffplay (avplay). Try this:

$ avconv -i the_video.avi -i sound/sticks.wav -map 0:0 -map 1:0 - | avplay -

The above is a guess based on your question but it's based on my own real example which I've pasted below just as a reference (yes I am using the ffmpeg and ffplay tools) :

ffmpeg -f alsa -i hw:0,2 -f v4l2 -i /dev/video0 -f avi pipe:1 | ffplay -
starfry
  • 401
  • 1
    I tried that and got pipe:: Invalid data found when processing input – Damian Yerrick Sep 03 '15 at 03:57
  • On my Arch Linux system the command line ffmpeg -f alsa -i hw:0,2 -f v4l2 -i /dev/video0 -f avi - | ffplay - opens a window with video and audio in it. I have ffmpeg 2.4.2. You need the final -f avi to specify a container format for the stream otherwise ffplay won't be able to process it. – starfry Sep 03 '15 at 08:25
  • avconv -i video.avi -i audio.wav -f avi - | avplay - gave pipe:: Operation not permitted – Damian Yerrick Sep 03 '15 at 14:24
  • Ah well, sorry not to be able to help. You could always get the proper "ffmpeg" (which the latest Ubuntu has switched back to). – starfry Sep 03 '15 at 14:47
  • How would I go about getting proper FFmpeg? Upgrading from 14.04 LTS to 15.04 through 14.10 is off-topic because 14.10 is more than 9 months old and not an LTS, and skipping a release is "highly not recommended" according to answers to Can I skip over releases when upgrading?. – Damian Yerrick Sep 03 '15 at 16:16
  • One option is to get it from upstream. There's a link from there to this PPA that has static precompiled binaries for 14.04. It looks just what you'd want but you're on your own really - I use Arch Linux myself. – starfry Sep 03 '15 at 19:07