FORUMS: list search recent posts

Deadend on converting a video file with multiple video streams

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
jake hi
Deadend on converting a video file with multiple video streams
on Feb 24, 2011 at 12:11:28 pm

Hello all,

As I found very few clues in the net and on the official documentation pages on ffmpeg.org, I've tried by myself many differents ways to convert a AVI file in wich there are 2 video streams incorporated.
It ended allways by an error. Looks like ffmpeg doesn't like puting 2 video streams together in one file.

Let's call the input file "doublevideo.avi". Inside, there are 3 streams: 0=> video1; 1=> audio1: 2=> video2. And I want to convert them to x264-aac in mp4 format.

The first try was to convert without any special multiple streaming options:
ffmpeg -i doublevideos.avi -vcodec libx264 -b 350k -r 30 -acodec libfaac -ab 64k -ar 24000 -ac 2 -vcodec libx264 -b 350k -r 30 -vpre slow -threads 0 -f mp4 videout1.mp4
Here, no problem, the video is clean and working. But it has only one video stream, the second one was leaved behind.

So, now I tried the option -map to tell ffmpeg to put the 3 streams inside the ouput video:
ffmpeg -y -i doublevideos.avi -vcodec libx264 -b 350k -r 30 -acodec libfaac -ab 64k -ar 24000 -ac 2 -vcodec libx264 -b 350k -r 30 -vpre slow -threads 0 -map 0:0 -map 0:1 -map 0:2 -f mp4 videout1.mp4
It give me that error message: "Number of stream maps must match number of output streams".
Here is the full error message:
Input #0, avi, from 'doublevideos.avi':
Duration: 00:01:33.99, start: 0.000000, bitrate: 20003 kb/s
Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc
Metadata:
title : FUJIFILM AVI STREAM 0200
Stream #0.1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Stream #0.2: Video: mjpeg, yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc
Metadata:
title : FUJIFILM AVI STREAM 0200
Number of stream maps must match number of output streams

3 streams input, 3 streams output and it tells me that the number of stream maps must match!? That's awkward! Looks like, ffmpeg doesn't like to put 2 video streams in one file here.

Never mind, I try another solution: I use -map on a second converting process to have 2 videos in 2 separated files and I'll mux them after the convertions:
ffmpeg -y -i doublevideos.avi -vcodec libx264 -b 350k -r 30 -acodec libfaac -ab 64k -ar 24000 -ac 2 -vcodec libx264 -b 350k -r 30 -vpre slow -threads 0 -map 0:2 -map 0:1 -f mp4 videout2.mp4
so now I have videout1.mp4 which has my firt video stream inside it and I also have videout2.mp4 which has my second video stream inside. Let's put them together with the -newvideo ffmpeg's option:
ffmpeg -y -i videout1.mp4 -i videout2.mp4 -vcodec copy -acodec copy -vcodec copy -acodec copy videout12.mp4 -newvideo
It seems to work, and it comes with an output file with 2 videos and one audio inside. Great! BUT, the second video stream was converted into an mpeg4 stream (and was in 200k b/s) completely avoiding my "-vcodec copy" option.
So, now I have a video file that contains 2 differents converting video streams: one in x264 and another one in mpeg4 (wich is lesser quality).
So, I've tried to put all the parameters in the second stream:
ffmpeg -y -i videout1.mp4 -i videout2.mp4 -vcodec copy -acodec copy -vcodec libx264 -r 30 -b 350k videout12.mp4 -newvideo
Ok, now I have a 350kbps video stream, but still in mpeg4.
I've tried many other solution, like puting the final format in m4v, and it gave me that error:
Error while opening encoder for output stream #0.2 - maybe incorrect parameters such as bit_rate, rate, width or height
Above the error message, I could read in red:
[libx264 @ 0x93dbb30] broken ffmpeg default settings detected
[libx264 @ 0x93dbb30] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0x93dbb30] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0x93dbb30] speed presets are listed in x264 --help
[libx264 @ 0x93dbb30] profile is optional; x264 defaults to high

So, I've tried to put "-vpre slow" "-vpre medium", etc...it allways give me the same damn message.

So, here is the end of my story. Of course, I've tried many other things with the ffmpeg manual, but I'll spare you the other less interesting issues I've found.
Thank you for reading me until here. I know it is long, but I think it is worth to find a solution for this as it is actualy the answer to "how to convert a 3D video file with ffmpeg?" question.

Thank you for your attention
Jake


Return to posts index

Michael Rampe
Re: Deadend on converting a video file with multiple video streams
on Mar 3, 2011 at 9:36:18 pm

[jake hi] "Great! BUT, the second video stream was converted into an mpeg4 stream (and was in 200k b/s) completely avoiding my "-vcodec copy" option."

When using new video you have to specify the encoding setting just before it (and after the output file).

So instead of:

ffmpeg -y -i videout1.mp4 -i videout2.mp4 -vcodec copy -acodec copy -vcodec copy -acodec copy videout12.mp4 -newvideo

try

ffmpeg -y -i videout1.mp4 -i videout2.mp4 -vcodec copy -acodec copy videout12.mp4 -vcodec copy -acodec copy -newvideo

Michael


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]