I need to get a video stream from my camera via RTSP and save it to a file. All of this needs to be done via gstreamer.
After some google searching, I tried the foll
The second command looks correct. Raw h264 video data is a bit tricky because it has two characteristics--"alignment" and "stream-format", which can vary. h264parse can transform h264 data into the form needed for different h264-related GStreamer elements.
avdec_h264 is a decoder element. You don't want to decode the data since you're apparently not displaying it. You're putting encoded h264 data from an RTSP stream into an mp4 container file.
If the file doesn't play, you should check that the stream is good, or try other media players and see if they work (mplayer, Media Player, Quicktime, whatever).
You could also try muxing into a matroska container file using the "matroskamux" element.