I have a multi-band HDF file that I want to convert to a single GeoTiff file, using free tools, preferably gdal. I'm trying to use gdal_translate, but I either get back multiple output .tif files, or I get "subdatasets" errors.
When I use the -b flag to specify bands:
gdal_translate -b 1 -b 2 -of GTiff input_image.hdf output_image.tif
I get "subdatasets" errors: "Input file contains subdatasets. Please, select one of them for reading."
And when I use the sds flag:
gdal_translate -sds -of GTiff input_file.hdf output_file.tif
I get back separate .tif files, one for each band in the input file.
How can I convert an HDF file into a single GeoTiff file using gdal?