Answers.Body: <p>The thing that worked for me was to encode it twice, not ideal, but it works:</p>
  <pre><code>ffmpeg -i in.mp4 out.mp4
  ffmpeg -i out.mp4 -c:v libx265 -vtag hvc1 -c:a copy out.mp4.mp4
  </code></pre>
  <p>Once I'm done, I remove the first file:</p>
  <pre><code>rm -f out.mp4
  mv out.mp4.mp4 out.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-12-10T12:24:19.757Z
Answers.LastActivityDate: 2024-12-10T12:24:58.837Z
Answers.LastEditDate: 2024-12-10T12:24:58.837Z
Answers.UserDisplayName: Walter White
Body: <p>I have legacy mpeg4 videos that do not play on chromecast and would like to convert - I believe x265 will be the best option for me, so while attempting to convert, while I have video, I no longer have audio.  I attempted to convert the media with this command line:</p>
  <pre><code>f=somefile.mpeg4
  ffmpeg -i $f -c:v libx265 -vtag hvc1 $f.x265
  ffmpeg -i $f -c:v libx265 -vtag hvc1 -map 0:a $f.x265
  ffmpeg -i $f -c:v libx265 -vtag hvc1 -c:a copy $f.x265
  </code></pre>
  <p>The first and third command line work, but yield no audio stream.  The second one fails, complaining that an x265 video can only have 1 video stream.</p>
  <p>My video looks like this:</p>
  <pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'somefile.mpeg4':
    Metadata:
      major_brand     : mp42
      minor_version   : 1
      compatible_brands: mp42isom3gp6
      creation_time   : 1970-01-03T01:38:05.000000Z
    Duration: 00:02:22.63, start: 0.000000, bitrate: 3565 kb/s
    Stream #0:0[0x2](eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 848x480 [SAR 1:1 DAR 53:30], 3430 kb/s, 23.40 fps, 25 tbr, 1k tbn (default)
      Metadata:
        creation_time   : 1970-01-03T01:38:05.000000Z
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
    Stream #0:1[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 129 kb/s (default)
      Metadata:
        creation_time   : 1970-01-03T01:38:05.000000Z
        handler_name    : Sound Media Handler
        vendor_id       : [0][0][0][0]
  </code></pre>
  
Tags: <ffmpeg><h.265>
Title: Convert mpeg4 to mp4 (x265 + aac)
UserDisplayName: Walter White
ThreadText: # Convert mpeg4 to mp4 (x265 + aac)
  
  (Asked by: username_0 on 2024-12-09)
  
  I have legacy mpeg4 videos that do not play on chromecast and would like to convert - I believe x265 will be the best option for me, so while attempting to convert, while I have video, I no longer have audio. I attempted to convert the media with this command line:
  
  ```
  f=somefile.mpeg4
  ffmpeg -i $f -c:v libx265 -vtag hvc1 $f.x265
  ffmpeg -i $f -c:v libx265 -vtag hvc1 -map 0:a $f.x265
  ffmpeg -i $f -c:v libx265 -vtag hvc1 -c:a copy $f.x265
  
  ```
  
  The first and third command line work, but yield no audio stream. The second one fails, complaining that an x265 video can only have 1 video stream.
  
  My video looks like this:
  
  ```
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'somefile.mpeg4':
    Metadata:
      major_brand     : mp42
      minor_version   : 1
      compatible_brands: mp42isom3gp6
      creation_time   : 1970-01-03T01:38:05.000000Z
    Duration: 00:02:22.63, start: 0.000000, bitrate: 3565 kb/s
    Stream #0:0[0x2](eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 848x480 [SAR 1:1 DAR 53:30], 3430 kb/s, 23.40 fps, 25 tbr, 1k tbn (default)
      Metadata:
        creation_time   : 1970-01-03T01:38:05.000000Z
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
    Stream #0:1[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 129 kb/s (default)
      Metadata:
        creation_time   : 1970-01-03T01:38:05.000000Z
        handler_name    : Sound Media Handler
        vendor_id       : [0][0][0][0]
  
  ```
  
  **Tags:** ffmpeg, h.265
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-12-10. Score: 0
  
  The thing that worked for me was to encode it twice, not ideal, but it works:
  
  ```
  ffmpeg -i in.mp4 out.mp4
  ffmpeg -i out.mp4 -c:v libx265 -vtag hvc1 -c:a copy out.mp4.mp4
  
  ```
  
  Once I'm done, I remove the first file:
  
  ```
  rm -f out.mp4
  mv out.mp4.mp4 out.mp4
  
  ```
  
  
  ---
  
  