Gstreamer H.264 transcoding pipeline help

I am having trouble building a Gstreamer pipeline for mp4 transcoding. The goal is to transcode a 1080p60 video (Big Buck Bunny) to 720p30 with audio passthrough.

The following pipeline does hardware assisted transcoding of the video stream, but all my attempts at including audio have failed:

gst-launch-1.0 filesrc location=bbb_1080p_60fps.mp4 !
qtdemux name=demux demux.video_0 !
queue !
h264parse !
omxh264dec !
queue !
nvvidconv ! video/x-raw,width=1280,height=720 !
videorate ! video/x-raw,framerate=30/1 !
queue !
omxh264enc control-rate=1 bitrate=3500000 iframeinterval=30 preset-level=3 profile=8 !
qtmux !
filesink location=out.mp4

ffprobe output for the video is as follows:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘bbb_1080p_60fps.mp4’:
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1
creation_time : 2013-12-16T17:59:32.000000Z
title : Big Buck Bunny, Sunflower version
artist : Blender Foundation 2008, Janus Bager Kristensen 2013
comment : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
genre : Animation
composer : Sacha Goedegebure
Duration: 00:10:34.53, start: 0.000000, bitrate: 4486 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 4001 kb/s, 60 fps, 60 tbr, 60k tbn, 120 tbc (default)
Metadata:
creation_time : 2013-12-16T17:59:32.000000Z
handler_name : GPAC ISO Video Handler
Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, s16p, 160 kb/s (default)
Metadata:
creation_time : 2013-12-16T17:59:37.000000Z
handler_name : GPAC ISO Audio Handler
Stream #0:2(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 320 kb/s (default)
Metadata:
creation_time : 2013-12-16T17:59:37.000000Z
handler_name : GPAC ISO Audio Handler
Side data:
audio service type: main

Does anyone know how to extend the gstreamer pipeline to include the mp3 audio stream in the output file? Including both audio streams in the output would be a bonus.

You may try:

gst-launch-1.0 -e filesrc location=bbb_1080p_60fps.mp4 ! qtdemux name=demux ! video/x-h264 ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! 'video/x-raw(memory:NVMM), width=1280, height=720' ! nvv4l2h264enc ! h264parse ! mux.   demux. ! queue ! audio/mpeg ! mux.     qtmux name=mux ! filesink location=test_out_720p.mov

It took some time for me to download the sample file, but this seems working:

gst-launch-1.0 -e filesrc location=/home/nvidia/Videos/bbb_sunflower_1080p_60fps_normal.mp4 ! qtdemux name=demux ! video/x-h264 ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! 'video/x-raw(memory:NVMM), width=1280, height=720' ! nvv4l2h264enc ! h264parse ! queue ! mux.      demux. ! audio/mpeg ! queue ! mpegaudioparse ! queue ! mux.      demux. ! audio/x-ac3 ! queue ! ac3parse ! queue ! mux.       qtmux name=mux ! filesink location=test_out_720p.mov

Thank you so much!!! That worked perfectly.

I noticed that you use nvv4l2decoder and nvv4l2h264enc instead of omxh264dec and omxh264enc. What is the reason for that? Do they provide better performance or functionality?

The reason is that omx plugins are being deprecated on Jetsons.
Performance may also be better depending on your use case.