The concepts and ideas of coherent, nonlinear and quantum optics have been extended to photon energies in the range of 10-100 kiloelectronvolts, corresponding to soft γ-ray radiation (the term used when the radiation is produced in nuclear transitions) or, equivalently, hard X-ray radiation (the term used when the radiation is produced by electron motion). The recent experimental achievements in this energy range include the demonstration of parametric down-conversion in the Langevin regime, electromagnetically induced transparency in a cavity, the collective Lamb shift, vacuum-assisted generation of atomic coherences and single-photon revival in nuclear absorbing multilayer structures. Also, realization of single-photon coherent storage and stimulated Raman adiabatic passage were recently proposed in this regime. More related work is discussed in a recent review. However, the number of tools for the coherent manipulation of interactions between γ-ray photons and nuclear ensembles remains limited. Here we suggest and implement an efficient method to control the waveforms of γ-ray photons coherently. In particular, we demonstrate the conversion of individual recoilless γ-ray photons into a coherent, ultrashort pulse train and into a double pulse. Our method is based on the resonant interaction of γ-ray photons with an ensemble of nuclei with a resonant transition frequency that is periodically modulated in time. The frequency modulation, which is achieved by a uniform vibration of the resonant absorber, owing to the Doppler effect, renders resonant absorption and dispersion both time dependent, allowing us to shape the waveforms of the incident γ-ray photons. We expect that this technique will lead to advances in the emerging fields of coherent and quantum γ-ray photon optics, providing a basis for the realization of γ-ray-photon/nuclear-ensemble interfaces and quantum interference effects at nuclear γ-ray transitions.