I have noticed that gstreamer1.0 on Raspbian comes with the omx plugins:

pi@pi ~ $ gst-inspect-1.0 | grep omx           
omx:  omxh264enc: OpenMAX H.264 Video Encoder       
omx:  omxvc1dec: OpenMAX WMV Video Decoder          
omx:  omxmjpegdec: OpenMAX MJPEG Video Decoder      
omx:  omxvp8dec: OpenMAX VP8 Video Decoder          
omx:  omxtheoradec: OpenMAX Theora Video Decoder    
omx:  omxh264dec: OpenMAX H.264 Video Decoder       
omx:  omxh263dec: OpenMAX H.263 Video Decoder       
omx:  omxmpeg4videodec: OpenMAX MPEG4 Video Decoder 
omx:  omxmpeg2videodec: OpenMAX MPEG2 Video Decoder 

I have googled and tried to construct a pipeline that takes a MKV file and uses the omxh264dec as well as the omxh264enc to transcode it to mp4 format. The examples that I found do not work or are easily adaptable and the gstreamter docs are... complex. Any hints?

Background to my question: I am using Plex Mediaserver on the Pi to manage my videos. I am mainly using AppleTV, iPhone and iPad to watch that media. The Apple devices easily only support h264 and aac in a mp4/m4v container. Hence I want to transcode some of the videos which do not match this. Plex can do this, but without hardware acceleration, so it's very slow. Plus I want to scale some videos down from 1080p to 720p for the iPhone and for disk space reasons. gstreamer with omx is reasonably fast and can do all these things I guess.


I am currently using avconv to remux mkv files to mp4, and using the builtin AAC encoder to recode AC3 tracks to AAC. This is probably the best I can do without doing actual video transcoding. An example command line:

avconv -i input.mkv -vcodec copy -acodec aac -strict experimental -o output.mp4

This will use the builtin aac encoder, which has to be enabled via the experimental switch. It may have some quirks, but so far it has worked fine for me. As long as I do not want to scale videos down to 720p, this seems to be fine and uses minimal amount of CPU.

2 Answers 2


MKV is just another container format. If it contains H.264 you can unwrap it and repack it into MPEG-4 using ffmpeg.

​ffmpeg -i vid.mkv -c copy -bsf:a aac_adtstoasc vid.mp4

  • Ok, I should have phrased better. I will update the question.
    – Arne
    Commented Nov 28, 2016 at 19:40

Have you looked at this sickbeard_mp4_converter? Don't be put off by the name, but I think it might solve what you're looking to do... by default it will take any input file and remix/reencode to H264/AAC2 in an MP4 container. It has a set of plugins for many indexers and automation tools too...

  • Please take the tour and visit the helpcenter to see how things work here. As Darth Vader has already pointed out, please note that answers here should stand on their own (in case the link rots). Please edit to improve, thanks.
    – Ghanima
    Commented Sep 18, 2017 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.