It sounds like you may have an intermittent spark plug. When you car is idling it is not producing that much electricity, and if your spark plug is dirty then it may not have the power to produce the spark and cause the engine to run rough at low rpm's. Check your spark plugs.
This could be the transmission. You should talk to a mechanic as soon as possible before it gets worse or it breaks down. It could be a cracked head though. If you notice anything when you switch gears then it is more than likely the transmission. The price of repair or replacement of a transmission ranges.