VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member
    Join Date: Aug 2014
    Location: Texas
    Search Comp PM
    OK, I can't believe I am asking this question, but here goes.

    If I encode my video to MPEG2 Intra only using the following:

    Code:
    ffmpeg -i input -vcodec mpeg2video -pix_fmt yuv422p -q:v 1 -qmin 1 -intra -an output.m2v
    is there a way to mux this m2v with the audio stream of the input file? I have tried various methods but come up dry e.g.

    Code:
    ffmpeg -i input.m2v -vcodec copy -i input.wav -acodec copy output.mpg
    Kicks off a "Unknown decoder 'copy'" error.

    I want to bring the m2v into PP/AE and start editing. But unless I am missing something, having the video and audio demuxed makes for a very messy editing experience.
    Quote Quote  
  2. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Code:
    ffmpeg -i input.m2v -i audio.wav -map 0:0 -map 1:0 -c:v copy -c:a copy output.mpg

    But you could have encoded the video & kept the audio (assuming you wanted to stream copy) in 1 step with -c:a copy . Or you could have encoded both in 1 step (assuming you wanted to re-encode the audio, replace -c:a copy with whatever)

    Code:
    ffmpeg -i input.ext -vcodec mpeg2video -pix_fmt yuv422p -q:v 1 -qmin 1 -intra -c:a copy output.mpg
    Quote Quote  
  3. vanished El Heggunte's Avatar
    Join Date: Jun 2009
    Location: Misplaced Childhood
    Search Comp PM
    mplex (from the MJPEG Tools package) is another option.
    Quote Quote  
  4. Member Cornucopia's Avatar
    Join Date: Oct 2001
    Location: Deep in the Heart of Texas
    Search Comp PM
    Originally Posted by SameSelf View Post
    OK, I can't believe I am asking this question, but here goes.

    If I encode my video to MPEG2 Intra only using the following:

    Code:
    ffmpeg -i input -vcodec mpeg2video -pix_fmt yuv422p -q:v 1 -qmin 1 -intra -an output.m2v
    is there a way to mux this m2v with the audio stream of the input file? I have tried various methods but come up dry e.g.

    Code:
    ffmpeg -i input.m2v -vcodec copy -i input.wav -acodec copy output.mpg
    Kicks off a "Unknown decoder 'copy'" error.

    I want to bring the m2v into PP/AE and start editing. But unless I am missing something, having the video and audio demuxed makes for a very messy editing experience.
    You must also be missing something, because editing demuxed/separate streams in PP/AE, etc is only slightly more than trivial. Drop your clips in the tracks, snap them to align sync, gang/group them and edit away. It takes longer to describe it than to do it.

    Scott
    "When will the rhetorical questions end?!" - George Carlin
    Quote Quote  
  5. Member
    Join Date: Aug 2014
    Location: Texas
    Search Comp PM
    Poisondeathray: First of all, thank you. I suspected that I could have encoded the audio the first time around. But since I grabbed that command line from the web, I was hesitant to tweak it. Ffmpeg while extremely flexible can be finicky when dealing with certain codecs. Also, my input file is an avisynth script using QTGMC so it takes a really long time.

    Cornucopia: fwiw I ended up biting the bullet and working with the demuxed files in PP/AE anyway because the audio is 5.1 Dolby Stereo and even with poisondeathray's excellent suggestion on how to mux I still couldn't get it to work. My problem is I am too used to selecting in and out points from the source clip window and dragging them to the timeline. I need to spend some time learning how to edit directly in the timeline. So your advice is noted. Because I have a feeling that muxing is a bad idea anyhow.
    Quote Quote  
  6. Member racer-x's Avatar
    Join Date: Mar 2003
    Location: 3rd Rock from the Sun
    Search Comp PM
    Why not use tsmuxer to MUX it into a TS container? Simple, fast and accurate. TS is well supported in many video editors.
    The memories of a man in his old age, are the deeds of the man in his prime.......
    Quote Quote  
  7. Member
    Join Date: Aug 2014
    Location: Texas
    Search Comp PM
    Originally Posted by racer-x View Post
    Why not use tsmuxer to MUX it into a TS container? Simple, fast and accurate. TS is well supported in many video editors.
    Arrogant response: I assumed if ffmpeg can't do it than nothing can
    Truthful response: never heard of TsMuxeR, but I will surely give it a try now, thanks racer-x
    Quote Quote  
  8. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Whenever you want to test something with ffmpeg, and don't want to waste time encoding just to see if it will work or not, you can test a small clip

    Use
    Code:
     -t time in duration in hh:mm:ss notation
    to encode a small section, say 20 seconds. You can use -ss for start time
    e.g encode a 20 second clip from 1minute to 1minute 20seconds

    Code:
    ffmpeg -i input.avs -c:v mpeg2video -pix_fmt yuv422p -q:v 1 -qmin 1 -intra -c:a pcm_s16le -s 00:01:00 -t 00:00:20 -f mpegts output.ts
    Transport stream is a better idea for higher bitrates, because ffmpeg's MPEG2-Program Stream muxer is probably muxing using DVD bitrate parameters. FFmpeg has a decent transport stream muxer, but TSMuxer suggested above is probably better

    Often some containers or muxers produce something that Adobe (or other software ) don't like. So it's always good to do small test on the workflow first
    Quote Quote  
  9. Member
    Join Date: Aug 2014
    Location: Texas
    Search Comp PM
    Thanks for the ffmpeg code snippet. I guess the name of the game is try alternatives to see what works best. I initially used ffmpeg's yadif for deinterlacing but learned about avisynth's QTGMC. So I guess there is no one tool does it all. Learn to use them all and you will be better for it.
    Quote Quote