I'm having limited success with transcoding MPEG-2 transport streams (recorded by TVHeadend using a Hauppauge HVR1600 on another machine) to H264 with an MPEG-4 container using my Raspberry Pi (512MB Model B) with Gstreamer and FFMpeg.
I compiled ffmpeg from source as instructed here: http://sirlagz.net/2013/01/07/how-to-st ... pi-part-3/
I installed a pre-compiled gstreamer from here: http://theiopage.blogspot.com/2013/04/e ... -with.html
GPU/RAM spilt is 256/256
Some recordings transcode just fine but others have audio/video sync issues later in the video. If I play the original transport stream in vlc it's synced just fine. I'm assuming the sync issue is due to transmission errors in the original file but since those types of things are going to happen I would like to know how to fix them but hopefully keep this process moving as quick as possible through the RPi.
Here's the meat of the code I'm using for this:
I have tried having gstreamer handle both audio and video with limited success but I like the speed of copying the audio with ffmpeg that wasn't available with my limited knowledge of gstreamer.
Code: Select all
#remove audio track from source and mux into mp4 container /usr/local/bin/ffmpeg -i "$input" -vn -acodec copy -y "$WorkPath"/temp.m4a #Transcode Video stream only to mp4 container gst-launch-1.0 -e filesrc location="$input" \ ! tsdemux \ ! mpegvideoparse \ ! omxmpeg2videodec \ ! deinterlace \ ! videoconvert \ ! omxh264enc inline-header=true periodicty-idr=1 \ ! "video/x-h264,stream-format=byte-stream,profile=high,control-rate=variable,target-bitrate=5000000,quant-i-frames=250" \ ! h264parse \ ! mp4mux ! filesink location="$WorkPath"/"temp.m4v" #Mux Audio & Video Files /usr/local/bin/ffmpeg -i "$WorkPath"/"temp.m4v" -i "$WorkPath"/"temp.m4a" -vcodec copy -map 0:0 -acodec copy -map 1:0 -shortest -y "$OutputPath"/"$OutputName"