Dear great developer community I am working on a embedded video box with gstreamer pipelines for video processing. All works fine but now I have a problem: I have an encoding pipeline for creating an mp4 out of my mkv video. But now I want to add an intro before the video and outro after the video. I have both files here as mkv and mp4. I need some help creating a pipeline creating my mp4 combining these 3 videos in serial. So intro is concatenated with the video and at the end the outro should be added too. Any idea how do a simple serial concatenation pipeline with gstreamer? I appreciate ALL help! EDIT for completion: my gstreamer install is really outdated - but I cannot update it now for multiple reasons (old arch linux, takes too much time to set up dev env). Here is my current bin that creates the mp4 from a raw mkv (MJPEG) movie:
QGst::BinPtr m_encBin = QGst::Bin::fromDescription(
"filesrc location=\""+path+"videoname.raw.mkv\" ! queue ! matroskademux name=\"demux\" "
"demux.video_00 ! queue ! ffmpegcolorspace ! queue ! x264enc ! queue ! mux.video_00 "
"demux.audio_00 ! queue ! audioconvert ! queue ! faac ! queue ! mux.audio_00 "
"mp4mux name=\"mux\" ! queue ! filesink name=\"filesink\" sync=false ", QGst::Bin::NoGhost);
When I add this bin to a pipeline its working fine and when I set the location var of the pipeline I get the mp4 file with audio. I now have a second pipeline that encs the intro.mp4 and outro.mp4 which is basically because I need to overlay text. What I need now is concatenate the movies. I don't care weather on the fly when demuxing or in the end with the mp4s.
UPDATE: I found a solution to do the concatenation for an up-to-date ffmpeg installation:
ffmpeg -i intro.mp4 -map 0 -c copy -f mpegts -bsf h264_mp4toannexb intro.ts
ffmpeg -i outro.mp4 -map 0 -c copy -f mpegts -bsf h264_mp4toannexb outro.ts
ffmpeg -i movie.mp4 -map 0 -c copy -f mpegts -bsf h264_mp4toannexb movie.ts
ffmpeg -i "concat:intro.ts|movie.ts|outro.ts" -c copy -absf aac_adtstoasc finalconcatmovie.mp4
Important: all movies need to have same size and codecs which is h264 with 1024x576 resolution. intro and outro don't have audio included while movie has an audio track. My ffmpeg installation now automatically adds empty audio tracks to intro and outro to be able to concatenate the movies.
The problem is I am running it on an old arch linux install and my ffmpeg won't create and add the audio channel automatically if it is missing. So I am stuck with this. Any idea how to add the audio and concatenate the movies?
Thank you Fredrik